Devices & Components
Arduino LilyPad Main Board
Sewable Conductive Thread
LilyPad Coin Cell Battery Holder - Switched - 20mm
Jumper wires (generic)
LilyPad LED White (5pcs)
Project description
Code
Dress Code
arduino
Cycles through modes for making the lights do cool things
1//Maddy McGee 2int list [] = {2, 3, 4, 5, 6};//ports used for lights 3int cycle; 4int cnter;//number of times a specific mode has ran 5void setup() { 6 for (int cnt = 0; cnt < 5; cnt ++) 7 { 8 pinMode(list[cnt], OUTPUT); 9 } 10 cycle = 0; 11 cnter = 0; 12} 13 14void loop() { 15 if(cycle == 0)//decending lights 16 { 17 for (int cnt = 0; cnt < 5; cnt ++) 18 { 19 digitalWrite(list[cnt], HIGH); 20 delay(500); 21 digitalWrite(list[cnt], LOW); 22 } 23 cnter++; 24 if (cnter > 2) 25 { 26 cycle = 1; 27 cnter = 0; 28 } 29 } 30 31 if(cycle == 1)//decending lights, fast 32 { 33 for (int cnt = 0; cnt < 5; cnt ++) 34 { 35 digitalWrite(list[cnt], HIGH); 36 delay(100); 37 digitalWrite(list[cnt], LOW); 38 } 39 cnter++; 40 if (cnter > 15) 41 { 42 cycle = 2; 43 cnter = 0; 44 } 45 } 46 47 if(cycle == 2)//decending lights all ON, then all OFF 48 { 49 for (int cnt = 0; cnt < 5; cnt ++) 50 { 51 digitalWrite(list[cnt], HIGH); 52 delay(500); 53 } 54 delay(1500); 55 for (int cnt = 4; cnt >=0; cnt --) 56 { 57 digitalWrite(list[cnt], LOW); 58 delay(500); 59 } 60 cycle = 3; 61 } 62 63 if(cycle == 3)//acending lights 64 { 65 for (int cnt = 4; cnt >=0; cnt --) 66 { 67 digitalWrite(list[cnt], HIGH); 68 delay(500); 69 digitalWrite(list[cnt], LOW); 70 } 71 cnter++; 72 if (cnter > 2) 73 { 74 cycle = 4; 75 cnter = 0; 76 } 77 } 78 79 if(cycle == 4)//acending lights, fast 80 { 81 for (int cnt = 4; cnt >=0; cnt --) 82 { 83 digitalWrite(list[cnt], HIGH); 84 delay(100); 85 digitalWrite(list[cnt], LOW); 86 } 87 cnter++; 88 if (cnter > 15) 89 { 90 cycle = 5; 91 cnter = 0; 92 } 93 } 94 95 if(cycle == 5)//acending lights all ON, then all OFF 96 { 97 for (int cnt = 4; cnt >=0; cnt --) 98 { 99 digitalWrite(list[cnt], HIGH); 100 delay(500); 101 } 102 delay(1500); 103 for (int cnt = 0; cnt < 5; cnt ++) 104 { 105 digitalWrite(list[cnt], LOW); 106 delay(500); 107 } 108 cycle = 0; 109 } 110 111 112}
Downloadable files
Dress Schematic
The actual layout of the wiring was a little more complicated, as there were really 30 LEDs hooked up the LilyPad, but they were in groups of varying size, each associated with one of the five shown LEDs. All the LEDs shared a ground and are controlled in the five groups by the signal wires connected to power of the LEDS
Dress Schematic
Dress Schematic
The actual layout of the wiring was a little more complicated, as there were really 30 LEDs hooked up the LilyPad, but they were in groups of varying size, each associated with one of the five shown LEDs. All the LEDs shared a ground and are controlled in the five groups by the signal wires connected to power of the LEDS
Dress Schematic
Comments
Only logged in users can leave comments