Here is my original code, this works.
/* Techno gloves! Here is some code for techno gloves with individual
finger control. Written in July 2011 by Kevin Venalainen and Bryan Hellard*/
// Set the Constants:
const int button1 = 10;
const int button2 = 6;
const int button3 = 2;
const int buttonm = A1; //Set the Button Pins
const int red1 = 13;
const int green1 = 12;
const int blue1 = 11;
const int red2 = 9;
const int green2 = 8;
const int blue2 = 7;
const int red3 = 5;
const int green3 = 4;
const int blue3 = 3; //Set the LED Pins
//Set the Variables:
int buttonPushCounterm = 0; //Main button counter
int buttonStatem = 0; //Main button state
int lastButtonStatem = 0; // Last main buton state
int buttonPushCounter1 = 0;
int buttonState1 = 0;
int lastButtonState1 = 0;
int buttonPushCounter2 = 0;
int buttonState2 = 0;
int lastButtonState2 = 0;
int buttonPushCounter3 = 0;
int buttonState3 = 0;
int lastButtonState3 = 0; //And set the rest (1, 2, 3)
void setup() {
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(buttonm, INPUT); //Buttons are inputting info
pinMode(blue1, OUTPUT);
pinMode(green1, OUTPUT);
pinMode(red1, OUTPUT);
pinMode(blue2, OUTPUT);
pinMode(green2, OUTPUT);
pinMode(red2, OUTPUT);
pinMode(blue3, OUTPUT);
pinMode(green3, OUTPUT);
pinMode(red3, OUTPUT); // LEDS are Outputs
Serial.begin(9600);} //Initialize serial communication.
void allblue(){
digitalWrite(blue1, HIGH);
digitalWrite(blue2, HIGH);
digitalWrite(blue3, HIGH);
allredoff();
allgreenoff();} //Function for Blue
void allblueoff(){
digitalWrite(blue1, LOW);
digitalWrite(blue2, LOW);
digitalWrite(blue3, LOW);} // Blue off
void allred(){
digitalWrite(red1, HIGH);
digitalWrite(red2, HIGH);
digitalWrite(red3, HIGH);
allblueoff();
allgreenoff();} //Fuction for Red
void allredoff(){
digitalWrite(red1, LOW);
digitalWrite(red2, LOW);
digitalWrite(red3, LOW);} // Red Off
void allgreen(){
digitalWrite(green1, HIGH);
digitalWrite(green2, HIGH);
digitalWrite(green3, HIGH);
allredoff();
allredoff();} //Function for Green
void allgreenoff(){
digitalWrite(green1, LOW);
digitalWrite(green2, LOW);
digitalWrite(green3, LOW);} //Green off
void alloff(){
allgreenoff();
allredoff();
allblueoff();} // All off
void loop() {
buttonStatem = digitalRead(buttonm); //Read the Main button
if (buttonStatem > lastButtonStatem) { //Compare it to its last state
buttonPushCounterm++; //Add one to the counter
if (buttonPushCounterm == 9) {
buttonPushCounterm = 1;} //If the counter reaches 9, reset back to 1
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounterm, DEC);} //Print what number
the counter is on
lastButtonStatem = buttonStatem; //Save the button state for next time looping
if (buttonPushCounterm == 1) {
alloff();
allgreen();} //What to do if the counter is 1
if (buttonPushCounterm == 2) {
alloff();
allgreen();
delay(6);
allgreenoff();
delay(1);
allblue();
delay(6);
allblueoff();
delay(1);} // If its 2
if (buttonPushCounterm == 3){
alloff();
allblue();} // 3
if (buttonPushCounterm == 4){
alloff();
allblue();
delay(6);
allblueoff();
delay(1);
allred();
delay(6);
allredoff();
delay(1);} // 4
if (buttonPushCounterm == 5){
alloff();
allred();} // 5
if (buttonPushCounterm == 6){
alloff();
allgreen();
delay(6);
allgreenoff();
delay(1);
allred();
delay(6);
allredoff();
delay(1);} // 6
if (buttonPushCounterm == 7){
alloff();
allgreen();
delay(8);
allgreenoff();
allblue();
delay(8);
allblueoff();
allred();
delay(8p89);
allredoff();} // 7
if (buttonPushCounterm == 8){
alloff(); //Turn all the LEDS off
buttonState3 = digitalRead(button3);
buttonState2 = digitalRead(button2);
buttonState1 = digitalRead(button1); // Read the 3 buttons
if (buttonState3 > lastButtonState3){ //Compare button 3
buttonPushCounter3++; // Add 1 to the counter
if (buttonPushCounter3 == 8) {
buttonPushCounter3 = 1;} // If the counter reaches 4, reset to 1
Serial.println("on");
Serial.print("Button 3 number of presses: ");
Serial.println(buttonPushCounter3, DEC);} // Serial print what number
the counter is on
lastButtonState3 = buttonState3; // Save the State for next time
if (buttonPushCounter3 == 0){
alloff();} // Start all off
if (buttonPushCounter3 == 1){
digitalWrite(green3, LOW);
digitalWrite(red3, HIGH);} // Red
if (buttonPushCounter3 == 2){
digitalWrite(red3, HIGH);
digitalWrite(blue3, HIGH);} // Purple
if (buttonPushCounter3 == 3){
digitalWrite(blue3, HIGH);
digitalWrite(red3, LOW);} // Blue
if (buttonPushCounter3 == 4){
digitalWrite(blue3, HIGH);
digitalWrite(green3, HIGH);} // Teal
if (buttonPushCounter3 == 5){
digitalWrite(blue3, LOW);
digitalWrite(green3, HIGH);} // Green
if (buttonPushCounter3 == 6){
digitalWrite(green3, HIGH);
digitalWrite(red3, HIGH);} // Yellow
if (buttonPushCounter3 == 7){
digitalWrite(green3, HIGH);
digitalWrite(blue3, HIGH);
digitalWrite(red3, HIGH);} //Strobe
if (buttonState2 > lastButtonState2){ // Compare Button 2
buttonPushCounter2++;
if (buttonPushCounter2 == 8) {
buttonPushCounter2 = 1;} // Add to the counter
Serial.println("on");
Serial.print("Button 2 number of presses: ");
Serial.println(buttonPushCounter2, DEC);} // Serial print the number
lastButtonState2 = buttonState2; // Save it for next time
if (buttonPushCounter1 == 0){
alloff();} // Start all off
if (buttonPushCounter2 == 1){
digitalWrite(green2, LOW);
digitalWrite(red2, HIGH);} // Red
if (buttonPushCounter2 == 2){
digitalWrite(red2, HIGH);
digitalWrite(blue2, HIGH);} // Purple
if (buttonPushCounter2 == 3){
digitalWrite(blue2, HIGH);
digitalWrite(red2, LOW);} // Blue
if (buttonPushCounter2 == 4){
digitalWrite(blue2, HIGH);
digitalWrite(green2, HIGH);} // Teal
if (buttonPushCounter2 == 5){
digitalWrite(blue2, LOW);
digitalWrite(green2, HIGH);} // Green
if (buttonPushCounter2 == 6){
digitalWrite(green2, HIGH);
digitalWrite(red2, HIGH);} // Yellow
if (buttonPushCounter2 == 7){
digitalWrite(green2, HIGH);
digitalWrite(blue2, HIGH);
digitalWrite(red2, HIGH);} //Strobe
if (buttonState1 > lastButtonState1){ //Compare button 1
buttonPushCounter1++; // Add to the counter
if (buttonPushCounter1 == 8) {
buttonPushCounter1 = 1;} // Reset when it reaches max
Serial.println("on");
Serial.print("Button 1 number of presses: ");
Serial.println(buttonPushCounter1, DEC);} // Print the number
lastButtonState1 = buttonState1; // Save for next time
if (buttonPushCounter1 == 0){
alloff();} // Start all off
if (buttonPushCounter1 == 1){
digitalWrite(green1, LOW);
digitalWrite(red1, HIGH);} // Red
if (buttonPushCounter1 == 2){
digitalWrite(red1, HIGH);
digitalWrite(blue1, HIGH);} // Purple
if (buttonPushCounter1 == 3){
digitalWrite(blue1, HIGH);
digitalWrite(red1, LOW);} // Blue
if (buttonPushCounter1 == 4){
digitalWrite(blue1, HIGH);
digitalWrite(green1, HIGH);} // Teal
if (buttonPushCounter1 == 5){
digitalWrite(blue1, LOW);
digitalWrite(green1, HIGH);} // Green
if (buttonPushCounter1 == 6){
digitalWrite(green1, HIGH);
digitalWrite(red1, HIGH);} // Yellow
if (buttonPushCounter1 == 7){
digitalWrite(green1, HIGH);
digitalWrite(blue1, HIGH);
digitalWrite(red1, HIGH);} // White
} //End of what to do if Main button Counter = 8
} // End of program