Issue with Ping driver?
Rayman
Posts: 14,646
in Propeller 1
Code for robot waits for ping reading to be less than 12 inches and then do something.
But, a loop that only calls ping driver does not work...
The Ping LED doesn't even turn on if you do this...
Adding a delay to the loop seems to fix the issue.
Maybe that's a "feature", but I'm tempted to call that a bug...
But, a loop that only calls ping driver does not work...
repeat j:=ping.Inches(PING_Pin) if j<12 (do something)
The Ping LED doesn't even turn on if you do this...
Adding a delay to the loop seems to fix the issue.
Maybe that's a "feature", but I'm tempted to call that a bug...
Comments
The jumper is set to 5V.
But, come to think of it, I didn't have this issue running the same code on an old Activity Board...
Strange...
There must be some difference between old Activity Board and Activity Board WX.
Or, maybe I have a bad WX board...
Tried two different Ping modules, so I don't think there's a problem there...
I tried both P16 and P17 headers on the WX board and they both have this issue.
This isn't horrible, I just insert a delay and then it seems to work.
Still, left me scratching my head...
In your loop there are only 3 code lines, so it's much faster.
What happens when you call ping over and over before it's done with the first result?
Taken from:
http://obex.parallax.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://obex.parallax.com/sites/default/files/obj/id/454/Ping_Demo_- _Archive__Date_2011.06.13__Time_14.44.zip & nid = 454
-Phil
But, I'm 99% sure my old Activity Board worked without this delay.
(Wish I hadn't just gave it away now).
I suppose it's possible that I remember wrong and had some debug code in there that I removed and thereby broke the code...
If that's the case, then I'm back to thinking there should be a, say, 100 us delay added to the driver.
Or, some note that a delay is needed...
-Phil