A6 Pin on B Series Not Working as Interrupt

#include "Particle.h"                                                                                                                                                                                                                                                             
uint32_t currentMillis;                                                                                                                                                                                                                                                                                                    
void setup() {                                                                                                                                                   
   pinMode(A6, INPUT_PULLDOWN);                                                                                                                                   
   startMillis = millis();                                                                                                                                        
   attachInterrupt(A6, theInterrupt, CHANGE);                                                                                                                     
   attachInterrupt(A7, theInterrupt, CHANGE);                                                                                                                     
void loop() {                                                                                                                                                    
   currentMillis = millis();                                                                                                                                      
   if (currentMillis - startMillis >= 1000) {                                                                                                                     
       startMillis = currentMillis;                                                                                                                                 
void theInterrupt() {                                                                                                                                            

When I attach an interrupts to ONLY A6, it works just fine. But when I ALSO attach an interrupt to A7, then A7 works fine, but A6 stops working.

I am flashing to a B Series B402.

Any ideas whats going on here?

Hi @risingtiger -

I am just trying to make sure I fully understand, so my apologies for the trivial questions;

Only pinMode for A6 is set here, is there a reason for not setting A7 then as well?

Are you pulling each pin either HIGH or LOW to affect the interrupt? I normally use either RISING or FALLING as opposed to CHANGE


@risingtiger, putting Serial.println() in an ISR is not good. You should instead set a flag you can read in loop() or turn on an externally connected LED.

1 Like

I believe I found the issue. The circuit board this is attached to is having a voltage drop that is interfering with the rise and fall of the signal. Once we took care of that its working for both A6 and A7.

1 Like

You are right about the Serial.println. I had this in there for just a code example, should have had a different example like flicking an led.



I reverently had an issue with the A2 interrupt was being triggered each time my D7 pin activated a replay. Upon closer inspection I found the A2 trace was running in close proximity of the D7 and GND pins which seemed to caused this problem. So it seems safe to assume this type of problem can indeed occur with voltage drop, capacitive coupling etc :slight_smile:

I cut the trace and problem was solved.

Glad you managed to resolve this!

Regards, Friedl

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.