Tuesday, October 03, 2006

jingle bells

team :: koro.NET

a light show...




file: sensor 100206
By flipping the "cleared" and "tripped" commands in the code, such that the "cleared" is first and, at the same time, flipping the PIR value so that "0" comes before "1", the lights start in the "on" position [lit] and then turn off when the sensor is triggered. After triggering, on the 3rd second it turns back to the "on" position.

By taking the "counter" argument out (counter = counter +1), the lights blink twice. Keeping the argument and altering it like this: counter = counter +10, the lights blink three times.

file: 3 lights
the next step was to create a condition in which the lights would respnd differently to the same trigger. the starting position is with the red and green lights on. when detecting a movement they switch off and the yellow one lights, then they come back to the first position again (red and green on). If the detected movement is more intense, the process is repeated a second time.

code :: posted in order of trial

// ON_OFF CODE [with all lights on]
'{$STAMP BS2}

'{$PBASIC 2.5}
DO HIGH 2
PAUSE 3000
LOW 2
PAUSE 3000

LOOP

// ON_OFF CODE [using sensor]
' {$STAMP BS2}
' {$PBASIC 2.5}
PIR PIN 3 ' this is the P# port that your PIR is wired to
counter VAR Byte ' Trip Counter

Main:

DO

IF PIR = 1 THEN ' Motion Detected?

counter = counter + 1 ' Update Trip Counter

HIGH 10 ' send power to flexinol

DEBUG HOME, "TRIPPED...", DEC3 counter

DO : LOOP UNTIL PIR = 0 ' Wait For PIR To Clear

DEBUG HOME, "CLEARED...", DEC3 counter

LOW 10 ' Turn Off flexinol

ENDIF

LOOP

' {$STAMP BS2}
' {$PBASIC 2.5}

// ON_OFF [using sensor and flipping the values]
PIR PIN 1 ' this is the P# port that your PIR is wired to
counter VAR BYTE ' Trip Counter

Main:
DO
IF PIR = 0 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 10 ' send power to flexinol
DEBUG HOME, "CLEARED...", DEC3 counter
DO : LOOP UNTIL PIR = 1 ' Wait For PIR To Clear
DEBUG HOME, "TRIPPED...", DEC3 counter
LOW 10 ' Turn Off flexinol
ENDIF
LOOP 'OPPOSITE OF ORIGINAL'

// ON_OFF [red and green starting on and yellow starting off]
' {$STAMP BS2}
' {$PBASIC 2.5}


PIR PIN 1 ' this is the P# port that your PIR is wired to
counter VAR BYTE ' Trip Counter

Main:
DO
IF PIR = 0 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 10 ' send power to flexinol
DEBUG HOME, "CLEARED...", DEC3 counter
DO : LOOP UNTIL PIR = 1 ' Wait For PIR To Clear
DEBUG HOME, "TRIPPED...", DEC3 counter
LOW 10 ' Turn Off flexinol
ELSEIF PIR = 1 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 7 ' send power to flexinol
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0 ' Wait For PIR To Clear
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 7 ' Turn Off flexinol
ENDIF
LOOP


Test Runs

video #1

video #2


Comments: Post a Comment



<< Home

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