22 lines
395 B
Arduino
22 lines
395 B
Arduino
|
const unsigned int BUTTON_PIN = 7;
|
||
|
const unsigned int LED_PIN = 13;
|
||
|
|
||
|
int ledState = LOW;
|
||
|
|
||
|
void setup() {
|
||
|
pinMode(LED_PIN, OUTPUT);
|
||
|
pinMode(BUTTON_PIN, INPUT);
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
const int CURRENT_BUTTON_STATE = digitalRead(BUTTON_PIN);
|
||
|
|
||
|
if (CURRENT_BUTTON_STATE == HIGH) {
|
||
|
ledState = HIGH;
|
||
|
} else {
|
||
|
ledState = LOW;
|
||
|
}
|
||
|
|
||
|
digitalWrite(LED_PIN, ledState);
|
||
|
}
|