//Turn on LED using Arduino controlled by a button //define the pin constants int ledPin = 22; int button = 23; void setup(){ //set the led pin to output pinMode(ledPin, OUTPUT); //set the button to input pinMode(button, INPUT); } void loop(){ //read and store the button state boolean State = digitalRead(button); //set the led to the button state digitalWrite(ledPin,State); }