Here is good working code for the Atom Pro and the PING. The values are converted to inches before display. This is for the IDE 8.0.1.7 and will work with the Mini-ABB and the Bot Board II.
[code]wdist var word
main:
low p4
pulsout p4, 5
input p4
pulsin p4, 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]
New here, just sharing some code for the Bot Board and PING:
This sub code “getping” works for a Parallax PING))) utrasonic sensor on a bot board with Basic Atom Pro (based on code by Stef van den Elzen):
getping:
low ping
high ping
pulsin ping, 0, pingRaw 'read the ping
low ping
pingRaw = pingRaw / 2 'adj for per sec since reading are every 0.5 sec
pingRange = pingRaw / 29 'convert to cm
return
where,
pingRaw var word
pingRange var word
ping CON P1
The parameters of interest can be monitored in the terminal window by inserting this sub:
Why is the ping wired to the breadboard (picture in post above)? I’d like to wire mine up to the Bot Board II directly and can’t find any wiring diagrams on how to wire it to the pins. I know this is simple but I don’t want to fry anything. Can anyone direct me to a picture of a ping wired directly to the Bot Board II?
All you need to do is buy s servo extender cable and remove the pins from one end. This makes it into a female / female cable. One end goes to the Ping and the other plugs directly into the Bot Board. You must make sure the power for that group is set to 5vdc not VS.
and in the sample code above I’d use 4 on #14. My only power in is #5 to a 9 volt battery but with the jumper in #13 over to 5V not VS it takes it down to 5 volts from 9 volts.
i try out the code you have provide on pin 4, pin 5, pin 6 and pin 7, it works, but i doesn’t work when i connect it to
pin 1, pin 2 and pin 3.
why is it so?