17 lines
303 B
C++
17 lines
303 B
C++
const int HALL_PIN = 2;
|
|
|
|
void setup() {
|
|
pinMode(LED_BUILTIN, OUTPUT);
|
|
pinMode(HALL_PIN, INPUT);
|
|
}
|
|
|
|
void loop() {
|
|
int hall_value = digitalRead(HALL_PIN);
|
|
if (hall_value == HIGH) {
|
|
digitalWrite(LED_BUILTIN, LOW);
|
|
} else {
|
|
digitalWrite(LED_BUILTIN, HIGH);
|
|
}
|
|
delay(10); //debounce?
|
|
}
|