BS2 Code for motion LED project
stuartX
Posts: 88
I'm creating a project that LED striplights are trigger by motion sensors. I have the code posted below. The problem I'm seeing is that it seems that when one sensor is triggered to light the LEDs and if a second sensor is triggered within the same time frame of the first sensor being triggered, the second motion is ignored until first sensor is off.
What I would like to happen is if one sensor is triggered, it lights that set of leds and at the same time if a second sensor is triggered it will in addition light the second set of leds at the same time.
What I would like to happen is if one sensor is triggered, it lights that set of leds and at the same time if a second sensor is triggered it will in addition light the second set of leds at the same time.
' {$STAMP BS2} ' {$PBASIC 2.5} ' {$PORT COM9} ' +++[Defining I/O ]++++++++++++++++++++++++++++++++++++ 'Input from motion sensors trigger LED pin high to Gate of individual Mosfets tied to LED strips. 'StepSen1 PIN 15 ' Lower level steps motion sensor 'FoyerSen PIN 14 ' Foyer motion sensor 'StepSen2 PIN 13 ' Upper level steps motion sensor 'BathSen PIN 12 ' Outside half-bath motion sensor 'HallSen PIN 11 ' Hallway motion sensor StepLED1 PIN 9 ' Lower level steps LED FoyerLED PIN 8 ' Foyer LED Stairs2LED PIN 7 ' Upper level stairs LED HallwayLED PIN 6 ' Hallway LED Hallway2LED PIN 5 ' Hallway/Loft LED Main: PAUSE 3000 DO DEBUG BIN1 IN15 DEBUG BIN1 IN14 DO LOOP UNTIL (IN15 = 1 ) HIGH StepLED1 PAUSE 5000 LOW StepLED1 DO LOOP UNTIL (IN14 = 1 ) HIGH FoyerLED PAUSE 5000 LOW FoyerLED DO LOOP UNTIL (IN13 = 1 ) HIGH Stairs2LED PAUSE 5000 LOW Stairs2LED DO LOOP UNTIL (IN12 = 1) OR (IN11 = 1 ) HIGH HallwayLED HIGH Hallway2LED PAUSE 5000 LOW HallwayLED LOW Hallway2LED PAUSE 1 LOOP
Comments
Jim
would I connect the output pin of the stamp to the trigger?