difficulty to generate interrupt signal with G26 on M5StickC Plus

  • I feel embarrassed to ask for such a stupid issue:
    I cannot get a simple button attached to G26 (pressed: G26->GND) generate an interrupt and light up the on board LED. With digitalRead it works. I want to use the interrupt version to read pwm signals eventually.
    I am using Arduino-IDE.

    Here is my code:

    #include <M5StickCPlus.h>
    /* pin that is attached to interrupt */
    uint8_t interruptPin = 26;

    void pressed() {
    digitalWrite(10, LOW); // LED on
    digitalWrite(10,HIGH); // LED off

    void setup() {
    // when pin G26 goes low, call the pressed function
    attachInterrupt(digitalPinToInterrupt(interruptPin), pressed, LOW);
    digitalWrite(10, HIGH); // LED off to start with

    void loop() {
    // put your main code here, to run repeatedly:

  • Hello @Marco-Cantoni

    try FALLING instead of LOW when calling attachInterrupt().