Devices & Components
LilyPad ProtoSnap Plus
Sewable Conductive Thread
Battery, 3.7 V
Alligator Clips
Hardware & Tools
Hot glue gun
Scissors
Sewing Needle
Felt
Paper mask
Regular sewing thread
Software & Tools
Arduino IDE
Project description
Code
Light Sensing Masquerade Mask
arduino
1//variable for sensor pin 2int sensorPin = A2; 3 4//variable for light value 5int lightValue; 6 7//variable for LEDPin 8int LEDPin = 6; 9int greenPin = A7; 10int bluePin = A8; 11 12 13void setup() 14{ 15 int x; 16 17 // Set sensorPin as an INPUT 18 pinMode(sensorPin, INPUT); 19 20 // set LEDPins as OUTPUT 21 pinMode(LEDPin, OUTPUT); 22 pinMode(greenPin, OUTPUT); 23 pinMode(bluePin, OUTPUT); 24 25 26} 27 28void loop() 29{ 30 31 // Get the current light level 32 lightValue = analogRead(sensorPin); 33 34 35 // if light level is low, turn LEDs on 36 if (lightValue <= 15) 37 { 38 digitalWrite(LEDPin, HIGH); 39 digitalWrite(greenPin, HIGH); 40 digitalWrite(bluePin, HIGH); 41 } 42 43 // if light level is high, turn LEDs off 44 else { 45 digitalWrite(LEDPin, LOW); 46 digitalWrite(greenPin, LOW); 47 digitalWrite(bluePin, LOW); 48 } 49 50}
Downloadable files
Front view schematic
For sewing the LEDs to the felt
Front view schematic

Front view schematic
For sewing the LEDs to the felt
Front view schematic

Comments
Only logged in users can leave comments