Teensy 2.0 INT6 in Arduino

slackman

New member
Hi,
i'm using the small Teensy 2.0 and am not able to enable the INT6 (PE6). Reading works properly but interrupt is not fired. This pin is 10k pulled up and i tried to attach a falling signal interrupt - no luck :-(

Reading the Pin works properly but polling is'n very cool - some keystroke will be lost... :-/

Config: Arduino 1.0.2, current Tennsyduino

any suggestion?

Michael
 
Hello,

Did you ever resolve this issue? I was also trying to use INT6 on the Teensy 2.0 and it failed to work.

Code:

#define CH_PIN 24

void setup(){
pinMode(CH_PIN, INPUT);
attachInterrupt(CH_PIN, CH, FALLING);
}

Any help would be greatly appreciated.

Best,
Gabe
 
The forum prefers you provide a full compilable sketch to verify your problems ...

I don't think Teensy 2 has INT6, but Teensy++2.0 does, but it's on pin 18 (not 24). INT6 works for me with this test sketch

Code:
volatile uint32_t dings;

void ding() {
  dings++;
}

void setup(){
 Serial.begin(9600);
 pinMode(18,INPUT_PULLUP);
 attachInterrupt(18,ding,FALLING);
 } 
 
 void loop(){
   Serial.println(dings);
   delay(2000);
 }
 
Teensy2 has INT6 on pin24, this sketch works for me:

Code:
#include <avr/sleep.h>

const int wakeup_pin = 24; // INT6 at PE6
const int led_pin =11;

elapsedMillis blink_stopwatch;
unsigned long blink_interval = 500;

elapsedMillis sleep_stopwatch;
unsigned long sleep_interval = 8100;

void setup() {
  delay(1000);
  pinMode(wakeup_pin, INPUT_PULLUP);
  pinMode(led_pin, OUTPUT);
  blink_stopwatch = 0;
  sleep_stopwatch = 0;
}

ISR(INT6_vect) {}

void enterSleep(void) {
  sleep_enable();

  // attach INT6:
  EICRB = (EICRB & ~((1 << ISC60) | (1 << ISC61))) | (LOW << ISC60); // INT6: only LOW can trigger wake up from power down
  EIMSK |= (1 << INT6);

  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_cpu();

  // detach INT6:
  EIMSK &= ~(1 << INT6);

  sleep_disable();
}

bool led_state = 1;

void loop() {
  if (blink_stopwatch >= blink_interval) {
    digitalWrite(led_pin, led_state);
    led_state = !led_state;
    blink_stopwatch = 0;
  }
  if (sleep_stopwatch >= sleep_interval) {
    enterSleep();
    sleep_stopwatch = 0;
  }
}
 
Back
Top