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:
} -
Hello @Marco-Cantoni
try
FALLINGinstead ofLOWwhen callingattachInterrupt().Thanks
Felix
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login