Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

analogRead() triggers unrelated interrupt #541

Copy link
Copy link
Closed
@MaxSNi

Description

@MaxSNi
Issue body actions

I am experiencing a strange bug:

Whenever i use analogRead(), an unrelated interrupt will also trigger, and by changing around a little i could even get 2 interrupts to trigger with every analogRead().

I have not testet every analog pin, but so far this bug happens with A0, A3, A4, A5, A6, A7, but not A10, A11, A12, A13, A14.

I can reproduce the issue with the code below - every 2 seconds it will trigger AnalogRead() and this will trigger one of the button Interrupts. I have have multiple components hooked up as well, but this did not seem to change anything when i tried removing some of them, or having the button GPIOs unconnected.

const int BUTTON_1 = 25;
const int BUTTON_2 = 26;

void setup() 
{
  pinMode(BUTTON_1, INPUT_PULLUP);  
  pinMode(BUTTON_2, INPUT_PULLUP);
  
  attachInterrupt(BUTTON_1, int1, FALLING);
  attachInterrupt(BUTTON_2, int2, FALLING);
  
  Serial.begin(115200);
}

void loop() 
{
  delay(2000);  
  float derp = analogRead(A3);  
  Serial.println(derp);
}

void int1() 
{
  Serial.println("1 Interrupt triggered");
}

void int2() 
{
  Serial.println("2 Interrupt triggered");
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.