Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Last active June 6, 2017 15:16
Show Gist options
  • Save maxpromer/c29422d34e5f72b8161027f250c04e52 to your computer and use it in GitHub Desktop.
Save maxpromer/c29422d34e5f72b8161027f250c04e52 to your computer and use it in GitHub Desktop.
#define LED1 LED_BUILTIN
#define LED2 23
hw_timer_t *timer = NULL;
void onTimer(){
digitalWrite(LED2, !digitalRead(LED2));
}
void setup() {
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
timer = timerBegin(0, 80, true);
timerAttachInterrupt(timer, &onTimer, true);
timerAlarmWrite(timer, 300000, true);
timerAlarmEnable(timer);
}
void loop() {
digitalWrite(LED1, !digitalRead(LED1));
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment