Arduino Testing

 

Digital Input – Button

Digital Input – Troubleshooter

Analog Input – Potentiometer

 

 

My code doesn’t work.. I tried adding and changing the ‘else’ and ‘if’ commands, but that didn’t work either.

 

const int buttonPin1 = 2;
const int buttonPin2 = 3;
const int ledPin = 13;

int buttonState = 0;
void setup() {

pinMode(ledPin, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}
void loop() {

buttonState = digitalRead(buttonPin1);

if (buttonState == HIGH);

digitalWrite(ledPin, HIGH);
else
digitalWrite(ledPin, LOW);

}
void loop() {
buttonState = digitalRead(buttonPin2);

if (buttonState == HIGH);

digitalWrite(ledPin, LOW);

else
digitalWrite(ledPin, HIGH);

}
}

One thought on “Arduino Testing”

Comments are closed.