Can anyone fix this code please? (The error message is below).
const int buttonPin1 = 2;
const int buttonPin2 = 3;
const int ledPin = 9;
int buttonState = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}
void loop()
{
buttonState = digitalRead(buttonPin2);
or
buttonState = digitalRead(buttonPin1);
if (buttonState == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
Arduino: 1.8.19 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
6:3: error: expected primary-expression before 'or' token
or
^~
exit status 1
expected primary-expression before 'or' token
I am trying to light one LED with either one of two buttons.
Many thanks
astat101