int buttonPin = 2; //button is connected to this pin
int ledPin = 13; //led is connected to this pin
void setup() {
// put your setup code here, to run once:
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
bool buttonPressed = digitalRead(buttonPin);
if (buttonPressed) {
digitalWrite(ledPin, HIGH);
}
}