//Toggle//
#define button1 3
#define button2 4
int button1CS = 0;
int button2CS = 0;
int button1PS = 0;
int button2PS = 0;
void setup() {
//designate input/outputs
pinMode(button1, INPUT);
pinMode(button2, INPUT);
Serial.begin(9600);
}
void loop() {
button1CS = button1State();
button2CS = button2State();
if(button1PS != button1CS && button1CS ==HIGH){
Serial.println("button1");
button1PS = button1CS;
} else if(button1PS != button1CS && button1CS ==LOW){
button1PS = button1CS;
}
if(button2PS != button2CS && button2CS ==HIGH){
Serial.println("button2");
button2PS = button2CS;
} else if(button2PS != button2CS && button2CS ==LOW){
button2PS = button2CS;
}
delay(10);
}
int button1State(){
int currentState = digitalRead(button1);
//Serial.println(currentState);
return currentState;
}
int button2State(){
int currentState = digitalRead(button2);
//Serial.println(currentState);
return currentState;
}