Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Marco.Cantoni
    M
    • Continue chat with Marco.Cantoni
    • Start new chat with Marco.Cantoni
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    Marco.Cantoni

    @Marco.Cantoni

    0
    Reputation
    1
    Posts
    223
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Marco.Cantoni Follow

    Posts made by Marco.Cantoni

    • 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
      delay(100);
      digitalWrite(10,HIGH); // LED off
      }

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

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

      posted in Arduino
      M
      Marco.Cantoni