-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Description
Hello !, I use NodeMCU-32S board. I can't use 2 timer in code, the second timer not callback via timerAlarmWrite() but the first timer can callback and work.
My code :
#define LED1 LED_BUILTIN
#define LED2 23
hw_timer_t *timerOne = NULL;
hw_timer_t *timerTwo = NULL;
void onTimerOne(){
digitalWrite(LED1, !digitalRead(LED1));
}
void onTimerTwo(){
digitalWrite(LED2, !digitalRead(LED2));
}
void setup() {
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
timerOne = timerBegin(0, 80, true);
timerAttachInterrupt(timerOne, &onTimerOne, true);
timerAlarmWrite(timerOne, 500000, true);
timerAlarmEnable(timerOne);
timerStart(timerOne);
timerTwo = timerBegin(1, 80, true);
timerAttachInterrupt(timerTwo, &onTimerTwo, true);
timerAlarmWrite(timerTwo, 300000, true);
timerAlarmEnable(timerTwo);
timerStart(timerTwo);
}
void loop() {}
LED on board blink but LED on GPIO23 not blink.
Thank for reply.
Metadata
Metadata
Assignees
Labels
No labels