can i try to use attachInterrupt() with the CP Express for the internal IR ?
Like:
Code: Select all
attachInterrupt(digitalPinToInterrupt(39), irDoSomething, CHANGE); // internal IR
Moderators: adafruit_support_bill, adafruit
Code: Select all
attachInterrupt(digitalPinToInterrupt(39), irDoSomething, CHANGE); // internal IR
Code: Select all
attachInterrupt(digitalPinToInterrupt(39), irpause, CHANGE); // externer IR Empfänger
attachInterrupt(digitalPinToInterrupt(4), buttonlinks, CHANGE); // Button links
attachInterrupt(digitalPinToInterrupt(5), buttonrechts, CHANGE); // Button rechts
This seems to be false:adafruit_support_mike wrote:If you're using a Circuit Playground Express, all of the microcontroller's pins support interrupts. You just have to give attachInterrupt() the correct pin number, which will be the same one used by digitalRead().
Code: Select all
const uint8_t BUTTONA_PIN = 4;
const uint8_t BUTTONB_PIN = 5;
void setup() {
Serial.begin(9600);
pinMode(BUTTONA_PIN, INPUT_PULLDOWN);
pinMode(BUTTONB_PIN, INPUT_PULLDOWN);
attachInterrupt(
digitalPinToInterrupt(BUTTONA_PIN),
[](){
Serial.println("button A interrupt");
},
RISING);
attachInterrupt(
digitalPinToInterrupt(BUTTONB_PIN),
[](){
Serial.println("button B interrupt");
},
RISING);
}
void loop() {
if (digitalRead(BUTTONA_PIN)) {
Serial.println("Polling-Button A pressed");
}
if (digitalRead(BUTTONB_PIN)) {
Serial.println("Polling-Button B pressed");
}
delay(50);
}
Code: Select all
button B interrupt
Polling-Button B pressed
Polling-Button B pressed
Polling-Button B pressed
Code: Select all
Polling-Button A pressed
Polling-Button A pressed
Polling-Button A pressed
Code: Select all
{ PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // GPIO D4 / Left Button
Code: Select all
{ PORTB, 8, PIO_SERCOM_ALT, (PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel2, PWM4_CH0, TC4_CH0, EXTERNAL_INT_8 }, // GPIO 1 / A7 / UART TX