Last active
June 6, 2017 15:16
-
-
Save maxpromer/c29422d34e5f72b8161027f250c04e52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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