Tuesday, October 28, 2008
Touch Sensor Prototype 5: LED + Flexinol
Lisa Ekle, Pierre Gerlier, Keith Greenwald, Michael Walch
We set up a loop with 2 sensors for input and a LED and Flexinol for output. If one sensor is triggered alone, the LED turns on. If both sensors are triggered simultaneously, then the flexinol contracts.
Script:
' {$STAMP BS2}
' {$PBASIC 2.5}' WIRING NOTES: PIN 15 controls flexinol,
' PIN 11 controls LEDTriggerPin0 PIN 5 ' Pin that gets the touch sensor input
TriggerCount VAR Byte
Main:
DO LOW 11
LOW 15
TriggerCount = 0 IF TriggerPin0 = 1 THEN
TriggerCount = TriggerCount + 1 ' Check pin0, add to counter
DEBUG "sensor 0 on", CR
ENDIF
IF TriggerPin1 = 1 THEN
TriggerCount = TriggerCount + 1 ' Check pin0, add to counter
DEBUG "sensor 1 on", CR
ENDIF
IF TriggerCount >= 2 THEN ' Both on, turn on flexinol
HIGH 15
DEBUG "both sensors on", CR
PAUSE 1000
ELSEIF TriggerCount = 1 THEN ' Otherwise, turn on LED
HIGH 11
DEBUG "one sensor on", CR
ENDIF
PAUSE 1000
LOOP
Labels: flexinol, piezo, touch