Ultrasonic Sensor - Broken??
everest
Posts: 141
Hi, I've got a brand spanking new Ping)) sensor that I just hooked up to my STAMP2. I'm using super simple code, and I'm having all kinds of problems [noparse]:([/noparse] HEre's the code:
' PingTest.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
DO
PULSOUT 8, 5
PULSIN 8, 1, time
DEBUG HOME, "time = ", DEC5 time
PAUSE 100
LOOP
The result is 427 or 428 99% of the time, unless I'm within a few inches of what I want to range on. It will randomly give me correct values from say 3-4 feet, but it's very infrequent. I generally just see 428/428. I have the sensor attached to a long phone cord, about 10 feet long, and the two "eyes" are glued into a project case (hot glue, but around the edges, not blocking the sensor at all.
Any ideas? I have no idea why this isn't working. [noparse]:([/noparse]
-Jeff
' PingTest.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
DO
PULSOUT 8, 5
PULSIN 8, 1, time
DEBUG HOME, "time = ", DEC5 time
PAUSE 100
LOOP
The result is 427 or 428 99% of the time, unless I'm within a few inches of what I want to range on. It will randomly give me correct values from say 3-4 feet, but it's very infrequent. I generally just see 428/428. I have the sensor attached to a long phone cord, about 10 feet long, and the two "eyes" are glued into a project case (hot glue, but around the edges, not blocking the sensor at all.
Any ideas? I have no idea why this isn't working. [noparse]:([/noparse]
-Jeff
Comments
-Jeff
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
-Jeff