interrupt pins oin teensy 3.2

Status
Not open for further replies.
If your T_3.2 'Card' is handy - it notes on the front lower right edge : 'All digital pins have interrupt capability'.

That shows 34 pins [ 0-33] with digital gray shading.
 
Last edited:
Reassigning interrupts to different pins

I have a Teensy 3.2 project where I am using a APDS9960 gesture sensor that requires an interrupt. Works great with the default interrupt of 2.

I am trying to re-assign the default interrupt 2 to another pin because I want to use pin 2 for something else (to keep some buttons/sensors in numerical order). Would like to assign pin 0 as the interrupt pin instead.

I've been over the Arduino interrupt reference, and tried a number of things, but can't seem to make this simple change (if indeed it is simple).

// SparkFun_APDS9960 variables
byte interruptPin = 0;
#define APDS9960_INT interruptPin // Interrupt

// Set gesture interrupt pin as input
pinMode(APDS9960_INT, INPUT_PULLUP);

In setup I am using:
attachInterrupt(interruptPin, interruptRoutine, FALLING);

I also tried:
attachInterrupt(digitalPinToInterrupt(0), interruptRoutine, FALLING); // https://forum.pjrc.com/threads/32286-APDS-9960-with-teensy

Neither is working.

I've tried the following:

pinMode(0, INPUT);
digitalWrite(0,HIGH);


My ISR code:

if( isr_flag == 1 ) {
detachInterrupt(interruptPin);
handleGesture();
isr_flag = 0;
attachInterrupt(interruptPin, interruptRoutine, FALLING);
}

Any thoughts?
 
May have answered my own question...

// SparkFun_APDS9960
#define INT 0
#define APDS9960_INT 0

Using this, it appears to work. So I'm going with it!
 
Status
Not open for further replies.
Back
Top