Tuesday, October 14, 2008

measuring distance with PING sensor


this is the basic use of a ping sensor to measure distance in an output window.



' PingTest.bs2
' {$STAMP BS2}' {$PBASIC 2.5}


time VAR Word


DO
PULSOUT 15, 5


PULSIN 15, 1, time


time = time ** 2251


DEBUG CR, "Distance = ", DEC4 time, " cm"


PAUSE 100
LOOP



Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?