Mustachio_01.bas (2721Bytes)
Stumped again!
I am building a new little guy and I am getting consistently bad readings now that I have added more code to the program. Let me explain....
I double checked that the hardware is ok.
I tested the different elements seperately: Speaker, motors, sensor, etc. The sensor was tested using the little piece of code I keep around, inspired from the YDMII.
symbol trig = 4
symbol echo = 5
symbol range = w6
Symbol beep = 6
puls:
high trig
pause 10
low trig
pulsin echo,1,range
debug
if range < 250 then
sound beep,(range,10) low beep
endif
goto puls
It works pretty much flawlessly and lets me use the sensor and speaker as a theramin-like instrument. The problem comes when I put even the simplest code in. I instantly geta steady stream of either "0" or sometimes "1" as a value from the sensor.
I tried commenting out the less important parts of the code one after the other until I a left with the bare minimum and yet I am still left with a robot who constantly feels like there's something in front. I attached my current code as I may have left a critical error int here.
I also tried swapping the sensor out for another ( I bought a box of 6 of those SR04's a while back). I get the same problem.
I am sure someone out there has the piece of info I am missing.