Ping Sensor

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

Moderator: Benj

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

Ping Sensor

Postby willow » Tue Jul 28, 2015 10:13 am

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8330
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2381 times
Been thanked: 3393 times
Contact:

Re: Ping Sensor

Postby medelec35 » Tue Jul 28, 2015 1:14 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: Ping Sensor

Postby willow » Tue Jul 28, 2015 2:05 pm

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