Tuesday, October 14, 2008

Two LEDs with PING sensor

JON W. TURKULA, JOHN M. BECKER, WAYNE CONGER JR.

We decided to see if we could produce some variability in the output. to test this we set up one led to be triggered at any distance less than 15cm, and another led to be triggered at less than 3o cm. It worked so well, that we think other people should read this and tell us about how impressed they are. We are looking to use this type of output to create an output that has some gradation of effect based on distance.

' 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 20

IF time <>

IF time = 0015 THEN LOW 0

IF time > 0015 THEN LOW 0


IF time <>

IF time = 0030 THEN HIGH 3

IF time > 0030 THEN LOW 3


LOOP


Comments: Post a Comment



<< Home

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