I encounter a problem when using the digital.pinMode of the Snooze library: it doesn't matter whatever type of interrupt I used (FALLING, RISING, CHANGE), the firing always occur as CHANGE (i.e. occurs at both FALLING and RISING). I am using Teensy LC (I also tried it on Teensy 3.1, same problem encountered). Is there anything I have missed out?
#include <Snooze.h>
SnoozeDigital digital;
SnoozeTimer timer;
SnoozeBlock config_teensyLC(digital, timer);
int test_pin_1 = 6;
int test_pin_2 = 9;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digital.pinMode(test_pin_1, INPUT_PULLUP, FALLING);//pin, mode, type
digital.pinMode(test_pin_2, INPUT_PULLUP, FALLING);//pin, mode, type
timer.setTimer(5000);// milliseconds
}
void loop() {
int who;
who = Snooze.hibernate( config_teensyLC );
if (who == test_pin_1) {
for (int i = 0; i < 3; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}
}
if (who == test_pin_2) {
for (int i = 0; i < 6; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}
}
if (who == 36) {
for (int i = 0; i < 8; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}
}
}
#include <Snooze.h>
SnoozeDigital digital;
SnoozeTimer timer;
SnoozeBlock config_teensyLC(digital, timer);
int test_pin_1 = 6;
int test_pin_2 = 9;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digital.pinMode(test_pin_1, INPUT_PULLUP, FALLING);//pin, mode, type
digital.pinMode(test_pin_2, INPUT_PULLUP, FALLING);//pin, mode, type
timer.setTimer(5000);// milliseconds
}
void loop() {
int who;
who = Snooze.hibernate( config_teensyLC );
if (who == test_pin_1) {
for (int i = 0; i < 3; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}
}
if (who == test_pin_2) {
for (int i = 0; i < 6; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}
}
if (who == 36) {
for (int i = 0; i < 8; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}
}
}