const int buttonPin = 2; // the number of the pushbutton pin
const int buttonPintwo = 3;
const int ledPin = 13;
const int ledPintwo = 12; // the number of the LED pin
// variables will change:
int buttonState = 0;
int buttonStatetwo = 0;
int ledstate=LOW;
int ledstatetwo=LOW;
//int codecounter=0;
//int bright=0
int brightness = 0; // how bright the LED is
int fadeAmount = 5;
int brightnesstwo = 0; // how bright the LED is
int fadeAmounttwo = 5;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(ledPintwo, OUTPUT);
pinMode(buttonPin, INPUT);
pinMode(buttonPintwo, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonState = digitalRead(buttonPin);
if(buttonState==HIGH){
ledstate=!ledstate;
//codecounter=codecounter+1;
delay(100);//safe pressing time window
}
digitalWrite(ledPin, ledstate);
//second setup
buttonStatetwo = digitalRead(buttonPintwo);
if(buttonStatetwo==HIGH){
ledstatetwo=!ledstatetwo;
//codecounter=codecounter+1;
delay(100);//safe pressing time window
}
digitalWrite(ledPintwo, ledstatetwo);
}
// if(codecounter % 2 != 0) {
// digitalWrite(ledPin, HIGH);
// }
// if(codecounter % 2 == 0) {
// digitalWrite(ledPin, LOW);
// }
// if (buttonState=HIGH){ledstate=HIGH}
// if (buttonState=LOW){ledstate=LOW}
// digitalWrite(ledPin, ledstate)
// // check if the pushbutton is pressed.
// // if it is, the buttonState is HIGH:
// if (buttonState == HIGH) {
// // turn LED on:
// digitalWrite(ledPin, HIGH);
// } else {
// // turn LED off:
// digitalWrite(ledPin, LOW);
// }
//excercises all except 5