Teensy 4.1 Arduino 外部中断(引脚中断)最小示例

setup() 中,使用

teensy_interrupt_setup.ino
attachInterrupt(digitalPinToInterrupt(23), myInterrupt, RISING);

在 Teensy 引脚 23 上配置 RISING 边沿的中断。

添加此函数,它将在中断期间被调用:

teensy_interrupt_function.ino
void myInterrupt() {
  // 你的代码放在这里
}

Check out similar posts by category: Electronics, Teensy