Ping Sensor

A forum where Flowcode v6 user created components can be shared, discussed and reviewed.

Moderator: Benj

Post Reply
willow
Posts: 2
Joined: Tue Jul 28, 2015 9:39 am

Ping Sensor

Post by willow »

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>
----------------------------------------

medelec35
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

Post by medelec35 »

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
Martin

willow
Posts: 2
Joined: Tue Jul 28, 2015 9:39 am

Re: Ping Sensor

Post by willow »

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

Post Reply