本站改版新增arduino频道
ESP32C3 定时器
hw_timer_t * timer = NULL; hw_timer_t * timer2 = NULL; void ARDUINO_ISR_ATTR onTimer(){ Serial.println("00000"); } void ARDUINO_ISR_ATTR onTimer2(){ Serial.println("111111"); } void setup() { Serial.begin(115200); Serial.print("Timer"); // Set timer frequency to 1Mhz timer = timerBegin(1000000); timerAttachInterrupt(timer, &onTimer); timerAlarm(timer, 5000*1000, true, 0); timer2 = timerBegin(1000000); timerAttachInterrupt(timer2, &onTimer2); timerAlarm(timer2, 5000*1000, true, 1); } void loop() { Serial.println(" ms"); delay(1000); }
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0095148086547852 seconds