help ping and distance measurement
fred1456
Posts: 13
i have bough a new basic stamp 2 and·a ping)) sensor. The ping work but not correctly, it detect object at 15cm (about 6 inches), but not far of this distance.
Technical spécifications tell the ping detect objects 2cm to 3m.
the routine bellow show me numbers between 90(near) and 422, (15cm to infinite)
(sorry my english is poor)
could you tell me why it don't work far than 15cm ?
the routine
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Word
Get_Sonar:
LOW 15
PULSOUT 15, 5
PULSIN 15,1, x
DEBUG DEC ? x
PAUSE 200
GOTO get_sonar
Technical spécifications tell the ping detect objects 2cm to 3m.
the routine bellow show me numbers between 90(near) and 422, (15cm to infinite)
(sorry my english is poor)
could you tell me why it don't work far than 15cm ?
the routine
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Word
Get_Sonar:
LOW 15
PULSOUT 15, 5
PULSIN 15,1, x
DEBUG DEC ? x
PAUSE 200
GOTO get_sonar
Comments
Perhaps you should start with the sample programs, which can be found at the link below, then go on from there, after you understand them:
http://www.parallax.com/detail.asp?product_id=28015
Regards,
Bruce Bates
If you look at the example code, the code posted has the same routine for getting sonar.
Fred,
Are you sure tha the wait is long enough to eliminate echoes? ( That is the the main part of your code that is different. )
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support