by plingboot » Wed Nov 15, 2006 10:20 am
by plingboot
Wed Nov 15, 2006 10:20 am
bump, as they say...
Here's the code i've been using to test the sonar - which is plugged into AD port 2 (third one along from left).
I clear the controller and then upload just this snippet.
I figure that this should cause the led to blink more quickly as an object gets closer to the sensor and slower as it moves away. With the loop continuing until i stop it.
What i actually get is just a constant led blink. A couple of times it seemed to work correctly for a couple of seconds, but then it defaulted back to a steady blink.
Not sure whether the code is duff or the sensor.
Not sure whether it's worth mentioning, but i also have both a gyro and tilt sensor connected at the same time. Though i wouldn't have thought this made any difference.
Any help much appreciated.
'================================
dim a as integer
10:
a = sonar(2)
out 52,0
out 8,0
delay a
a = sonar(2)
out 52,1
out 8,1
delay a
goto 10
'===================================
bump, as they say...
Here's the code i've been using to test the sonar - which is plugged into AD port 2 (third one along from left).
I clear the controller and then upload just this snippet.
I figure that this should cause the led to blink more quickly as an object gets closer to the sensor and slower as it moves away. With the loop continuing until i stop it.
What i actually get is just a constant led blink. A couple of times it seemed to work correctly for a couple of seconds, but then it defaulted back to a steady blink.
Not sure whether the code is duff or the sensor.
Not sure whether it's worth mentioning, but i also have both a gyro and tilt sensor connected at the same time. Though i wouldn't have thought this made any difference.
Any help much appreciated.
'================================
dim a as integer
10:
a = sonar(2)
out 52,0
out 8,0
delay a
a = sonar(2)
out 52,1
out 8,1
delay a
goto 10
'===================================