led_bikewheel/led_bikewheel.ino
2020-12-28 16:47:45 +01:00

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?
}