Thursday, October 25, 2007
anothertryOut_knockDetection
http://forums.parallax.com/forums/default.aspx?f=6&m=225685
' {$STAMP BS2}
' {$PBASIC 2.5}
'This program will monitor the sound falling on a microphone,
'toggling a number of lights whenever a very loud sound is heard.
INPUT 1
INPUT 2
INPUT 3
#DEFINE pcell = 0
#DEFINE pcellpin = 0
time VAR Byte
OUTPUT 1
OUTPUT 2
OUTPUT 3
read_pcell:
RCTIME 0,1,time
DEBUG DEC time, CR
GOTO read_pcell
'////////////////////
is_light1_on:
IF time>1 THEN light1_on '<== See above regarding B2
light1_off:
IN1=0
GOTO is_light2_on
light1_on:
IN1=1
'/////////////
is_light2_on:
IF time>1 THEN light2_on '<== See above regarding B2
light2_off:
IN2=0
GOTO is_light3_on
light2_on:
IN2=1
'////////////
is_light3_on:
IF time>1 THEN light3_on '<== See above regarding B2
light3_off:
IN3=0
GOTO is_light4_on
light3_on:
IN3=1
'////////////
is_light4_on:
GOTO read_pcell
Labels: TSC