/* Lilypad Arduino Light Up Spider Costume Created by Sharon Kolling-Perin March 2015 */ int ledPin = 13; // LED is connected to digital pin 13 int lightSensorPin = A5; // Light sensor connected to analog pin 5 int whiteLeds = 9; // white LEDs connected to digital pin 9 int sensorValue; // variable to store the value coming from the light sensor int lightpos = A4; // Positive petal of light sensor connected to A4 int ground = 6; // Negative petals of LEDs connected to pin 6 void setup() { pinMode(ledPin, OUTPUT); // sets the ledPin to be an output pinMode(whiteLeds, OUTPUT); //sets white LEDs for eyes as output pinMode(lightpos, OUTPUT); //pins used for light sensor digitalWrite(lightpos, HIGH); pinMode(ground, OUTPUT); //set pin to ground digitalWrite(ground, LOW); // Turns off power to pin 9 (ground) } void loop() //run over and over again { sensorValue = analogRead(lightSensorPin); //read the value from the sensor delay(100); //wait for .1 seconds digitalWrite(whiteLeds, HIGH); //sets the LED on delay(10000); //waits for 10 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(1000); //waits for 1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(1000); //waits for 1 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(1000); //waits for 1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(1000); //waits for 1 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(1000); //waits for 1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(1000); //waits for 1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(1000); //waits for 1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(1000); //waits for 1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(1000); //waits for 1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(1000); //waits for 1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(2000); //waits for 2 seconds digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 seconds digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(100); //waits for .1 second digitalWrite(whiteLeds, HIGH); //sets the LED on delay(100); //waits for .1 second digitalWrite(whiteLeds, LOW); //sets the LED off delay(2000); //waits for 2 seconds }