Ping)))
Edgar
Posts: 8
Hello, I was testing a Ping))) range finder but couldn't get a reading beyond
5 inches. I used the hyper-terminal to read the values:
If I put my hands less than 5'' in front of it, it could read the distance.
I set the code to read every 1 second. Here is the code:
Is it something wrong I did or something wrong with the sensor I have?
- Thanks
5 inches. I used the hyper-terminal to read the values:
402us 5'' 138mm
If I put my hands less than 5'' in front of it, it could read the distance.
I set the code to read every 1 second. Here is the code:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 PING_Pin = 0 ' I/O Pin For PING))) VAR long range OBJ Debug: "FullDuplexSerial" ping : "ping" PUB Start Debug.start(31, 30, 0, 57600) Debug.str(string("Testing begins",10,13)) repeat ' Repeat Forever range := ping.Ticks(PING_Pin) ' Get Range in MicroSeconds Debug.dec(range) Debug.str(string("us ")) waitcnt(clkfreq + cnt) ' Pause 1 Second range := ping.Inches(PING_Pin) ' Get Range In Inches Debug.dec(range) Debug.str(string("'' ")) waitcnt(clkfreq + cnt) ' Pause 1 Second range := ping.Millimeters(PING_Pin) ' Get Range In Millimeters Debug.dec(range) Debug.str(string("mm",10,13)) waitcnt(clkfreq + cnt) ' Pause 1 Second
Is it something wrong I did or something wrong with the sensor I have?
- Thanks
Comments
I'll run your code when I get a chance, just to verify.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
The second one and it works.
- Thanks
I haven't had a chance to get it back out and try it again... Maybe it wasn't me. <shrug>
I'll test it again and see what happens.. Mine was a Radio Shack purchase as well..
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
A Living Propeller FAQ - The Propeller Wiki
(Got the Knowledge? Got a Moment? Add something today!)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.