#define GPIO_PIN D3
uint8_t led = LOW;
void setup(){
pinMode(GPIO_PIN, INPUT);
pinMode(BUILTIN_LED, OUTPUT);
setLED();
attachInterrupt(GPIO_PIN, highInterrupt, CHANGE);
}
void highInterrupt(){
led = digitalRead(GPIO_PIN);
}
void setLED(){
digitalWrite(BUILTIN_LED, led);
}
void loop(){
setLED();
}
Žádné komentáře:
Okomentovat