hi can anyone help with the configeration of the a hc-sr04 ultrasonic sensor as the example code I've adpted will only give me 17 or 0 output through a serial port.
Please see Below :
----------------------------------------
Comment:
This example program is configured to measure approximately 1.5-2m (150 - 200cm) from the sensor.
If much shorter distances are used, parameters will need to be changed.
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Loop:
1
<LOOP>
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Allows the potentiometer to be used to set the threshold level:
sense = sense / 20
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Delay:
100 ms
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Calculation:
dist = ToString$ (distance)
sens = ToString$ (sense)
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
----------------------------------------
Call Component Macro:
----------------------------------------
</LOOP>
----------------------------------------
Ping Sensor
Moderator: Benj
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Ping Sensor
Hi willow,
Perhaps a starting point would be this whole thread
If you do try the flowchart and get stuck then let us know.
Martin
Perhaps a starting point would be this whole thread
If you do try the flowchart and get stuck then let us know.
Martin
Martin
Re: Ping Sensor
Hi
The sensor is working ok with the arduino ping sketch example ,but it seem's more difficult to make it work on the flowcode 6 software ,the distance I'm working with is about 30-150mm max.
regards
The sensor is working ok with the arduino ping sketch example ,but it seem's more difficult to make it work on the flowcode 6 software ,the distance I'm working with is about 30-150mm max.
regards