Just trying to figure out the options for having my students this year program EL Wire for a dance performance, I wanted to find out if a momentary switch activated EL Wire costume would work. So I worked out a prototype, really just enough to make sure the wiring and programming would be feasible. It was easier than I expected. As a jumping off point I used a fantastic LadyAda Arduino switch tutorial that really explains things well. I still couldn't get the concept of a pull-down or pull-up resistor through my thick head but reading about it again in McRoberts' Beginning Arduino finally made it sink in.
The pics show that individual as well as multiple switch presses work. What my students will do if they want to pursue this idea is sew the switches into gloves and the wires into black outfits for a choreographed dance in the dark.
Here's the code:
UPDATE: The first version is all you need as I learned after making this discovery.
This version is only needed if you use different pins for input and output:int wirePin[] = {3,4,5}; // create array values corresponding to wire pinOuts int switchPin[] = {3,4,5}; // same with switch pins void setup() { for(int i = 0;i<3;i++) { pinMode(wirePin[i], OUTPUT); // Set the wire pins as output pinMode(switchPin[i], INPUT); // Set the switch pins as input } } void loop(){ }
int wirePin[] = {3,4,5}; // create array values corresponding to wire pinOuts int switchPin[] = {6,7,8}; // same with switch pins int val[3]; // variable for reading the pin status void setup() { for(int i = 0;i<3;i++) { pinMode(wirePin[i], OUTPUT); // Set the wire pins as output pinMode(switchPin[i], INPUT); // Set the switch pins as input val[i] = 0; // Set val array to 0 } } void loop(){ for(int i = 0;i<3;i++) { val[i] = digitalRead(switchPin[i]); // read input values and store it in val array if (val[i] == HIGH) { // check if any buttons are pressed for(int i = 0;i<3;i++) { digitalWrite(wirePin[i], HIGH); // turn wire on in same array index } } if (val[i] == LOW) { // check if buttons are not pressed for(int i = 0;i<3;i++) { digitalWrite(wirePin[i], LOW); // turn wires off } } } }

