Ultra Sonic Sensor need help coding to trigger event at specific distance.
JimL
Posts: 2
Hello all,
I am trying to figure out how to code the Basic Stamp to trigger a event when the US Sensor indicates the object is within a certain distance from the sensor. I think it is a "Do while" or "If" Statement but I am not a coder so if you could provide me with as much detail as you can without making it a special project for you I would greatly appreciate it. You can either post it here or send me a email jim@ly-core.com
I appreciate those who can assist in this.
Jim
I am trying to figure out how to code the Basic Stamp to trigger a event when the US Sensor indicates the object is within a certain distance from the sensor. I think it is a "Do while" or "If" Statement but I am not a coder so if you could provide me with as much detail as you can without making it a special project for you I would greatly appreciate it. You can either post it here or send me a email jim@ly-core.com
I appreciate those who can assist in this.
Jim
Comments
DO
Measure distance (pulsout, pulsin)
if distance<target then abc
LOOP
abc:
main:
Measure distance (pulsout, pulsin)
if distance>goalmax then abc' jump to label abc
if distance<goalmin then efg' jump to label efg
(code here executes if you create a hysteresis range goalmin<goalmax where your distance is OK as it)
goto main
abc:
(code here executes if distance>goalmax)
goto main
efg:
(code here executes if distance<goalmin)
goto main
Very kind of you, this will do the trick! I appreciate your time.