#include <TimerOne.h>
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT); // 設置內建 LED 為輸出
Timer1.initialize(1000000); // 初始化 Timer1,設置週期為 1 秒 (1000000 微秒)
Timer1.attachInterrupt(timerISR); // 設置中斷服務程序
}
void timerISR() {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // 每次中斷時翻轉 LED 狀態
}
void loop() {
// put your main code here, to run repeatedly:
}