Maixduino icon indicating copy to clipboard operation
Maixduino copied to clipboard

Only last attachInterrupt gets called

Open Gerharddc opened this issue 5 years ago • 0 comments

I want to run 4 different ISR for 4 different pins and am currently setting this up using

void setup()
{
  pinMode(LeftA, INPUT);
  pinMode(LeftB, INPUT);
  pinMode(RightA, INPUT);
  pinMode(RightB, INPUT);

  attachInterrupt(LeftA, callback_LeftA, RISING);
  attachInterrupt(LeftB, callback_LeftB, RISING);
  attachInterrupt(RightA, callback_RightA, RISING);
  attachInterrupt(RightB, callback_RightB, RISING);

  Serial.begin(9600);
}

but only "callback_RightB" ever gets called. If I comment out any 3 of the 4 "attachInterrupt" interrupt calls then the one left uncommented does actually work but if more than one is uncommented, only the last one works.

I am testing on an Maixduino programmed using PlatformIO with the Arduino framework if it makes any difference and the pins are defined as

#define LeftA 21
#define LeftB 22
#define RightA 23
#define RightB 24

but using other pins does not make a difference.

Gerharddc avatar Jul 03 '20 21:07 Gerharddc