Hey all, I have a minor mayday here…
I am using a BAP28 on a BotBoardII with a SRF04 ultrasonic ranger. My IDE is version 8.0.1.8 and the code, pasted below, is from Jim’s code posted as an announcement in this forum.
I have tried 2 SRF04 units and neither seems to be working via the terminal display. The first SRF04 is on my BAP28 robot and the second SRF04 is on an oopic based robot (wired to BAP28 for test) and tested working (several times) within seconds of running this code. The wiring has been verified countless times.
The terminal display shows nothing, just blank? The only way I know it is running is to Animate it and then it highlights the lines running. The code runs great until it hits the pulsin line and breaks to toolong. Even if the code breaks the terminal should show Timeout, sensor is not working as per the code? but it is not…
Since this code is listed as ‘tested and working’ that leaves me… any ideas what I am doing wrong?
Does anyone have a piece of SRF04 code for the BAP28 that is for sure working they want to share?
[code]
wdist var word
low p10 ;pin to initiate the sensor
low P11 ;pin to measure the return pulse
main:
pause 10
pulsout p10, 20
pulsin 11, 0, toolong, 40000, wdist
wdist = wdist / 148 ;convert for inches
serout s_out, i9600, "Distance: ", sdec wdist, 13, 10] ;display result in terminal
goto main
toolong: ; if the program gets here the sensor is not functioning, or wired wrong
serout s_out, i9600, “Timeout, sensor is not working”, 13]
goto main [/code]
Thanks a bunch,
Ted