Adding a simple button thingy
This commit is contained in:
parent
742fa9d141
commit
3b2d5d492e
1
arduino/SimpleButton/Makefile
Symbolic link
1
arduino/SimpleButton/Makefile
Symbolic link
@ -0,0 +1 @@
|
||||
../arduino.mk
|
17
arduino/SimpleButton/SimpleButton.ino
Normal file
17
arduino/SimpleButton/SimpleButton.ino
Normal file
@ -0,0 +1,17 @@
|
||||
const unsigned int BUTTON_PIN = 7;
|
||||
const unsigned int LED_PIN = 13;
|
||||
|
||||
void setup() {
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
pinMode(BUTTON_PIN, INPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
const int BUTTON_STATE = digitalRead(BUTTON_PIN);
|
||||
|
||||
if (BUTTON_STATE == HIGH) {
|
||||
digitalWrite(LED_PIN, HIGH);
|
||||
} else {
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user