BS2 + Ping Sensor
nick12
Posts: 1
this is my first time posting here
I am using a bs2 and the parallax ping sensor with the example distance code but when the sensor does not detect an object the program will not continue to run. I was hoping that anybody could suggest how to get the bs2 to continue to run without it freezing when an object is not detected for a extended period of time. Attached below is the example code that I am using
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
DO
PULSOUT 15,5
PULSIN 15, 1 , time
DEBUG HOME, "Time = ", DEC5 time
time = time ** 2251
DEBUG CR, "Distance = ", DEC4 time, "cm"
PAUSE 100
LOOP
I am using a bs2 and the parallax ping sensor with the example distance code but when the sensor does not detect an object the program will not continue to run. I was hoping that anybody could suggest how to get the bs2 to continue to run without it freezing when an object is not detected for a extended period of time. Attached below is the example code that I am using
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
DO
PULSOUT 15,5
PULSIN 15, 1 , time
DEBUG HOME, "Time = ", DEC5 time
time = time ** 2251
DEBUG CR, "Distance = ", DEC4 time, "cm"
PAUSE 100
LOOP
Comments
What is the evidence that the system is freezing? E.g., put a DEBUG statement before and after the DO, and another one after the PULSIN statements, to indicate that the program reached those statements. Do they all print?
PAR