Sound Implact Sensor Project with basic stamp 2
denzx
Posts: 4
in BASIC Stamp
So I am working on a project using the Sound Impact sensor, and my objective is to be able to turn on a system (light or fan) when you blow into the impact sensor and when you blow into it twice it then turns off the system.
i was able to figure out the commands that will turn on the system was this
' {$STAMP BS2}
' {$PBASIC 2.5}
Main:
DIR1=1
DO
IF IN15 = 1 THEN
HIGH 1
PAUSE 500
ELSEIF IN15 = 0 THEN
LOW 1
ENDIF
LOOP
IF IN15 = 1 THEN
but I just don't know what to do to make the system know that I want to turn off the system when I blow into it twice, any help will be appreciated.
i was able to figure out the commands that will turn on the system was this
' {$STAMP BS2}
' {$PBASIC 2.5}
Main:
DIR1=1
DO
IF IN15 = 1 THEN
HIGH 1
PAUSE 500
ELSEIF IN15 = 0 THEN
LOW 1
ENDIF
LOOP
IF IN15 = 1 THEN
but I just don't know what to do to make the system know that I want to turn off the system when I blow into it twice, any help will be appreciated.
Comments
1) You trigger the sensor once and the system turns on. You trigger the sensor a second time (once it's on) and the system turns off.
2) You trigger the sensor once (in some period of time) and the system turns on (or stays on). You trigger the sensor twice (in some period of time) and the system turns off (or stays off).
Which do you want?
i was able to figure out the commands that will turn on the system was this
' {$STAMP BS2}
' {$PBASIC 2.5}
Main:
DIR1=1
DO
IF IN15 = 1 THEN
HIGH 1
PAUSE 500
ELSEIF IN15 = 0 THEN
LOW 1
ENDIF
LOOP
IF IN15 = 1 THEN
but I just don't know what to do to make the system know that I want to turn off the system when I blow into it twice, any help will be appreciated.