Again it always helps to give a little more information, like example program that is not working and wiring setup and which version of Arduino and Teensyduino ...
More information in the documentation:
https://www.arduino.cc/en/Reference/attachInterrupt
But my assumption is here you are used to UNO where that attachIntterupt(0... ) Implies on Interrupt 0 which I believe is on UNO pin 2...
On Teensy boards as well as more advanced Arduino boards like DUE, the first parameter is the pin number, so you are asking for an interrupt on Pin 0...
So to make code work properly for simple AVR boards as well as more advanced, you will see up the docs:
Code:
const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
state = !state;
}
In here you will see they use the mapper function digitalPinToInterrupt, to map differently depending on which board. On UNO
digitalPinToInterrupt(2) will return 0, on Teensy it will return 2...