Skip to main content
added 6 characters in body
Source Link
jfpoilpret
  • 9.1k
  • 7
  • 37
  • 54

On all ArduinosArduino boards except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is different:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all Arduinos except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is different:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all Arduino boards except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is different:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

improved formatting,grammar, spelling
Source Link
BrettFolkins
  • 4.4k
  • 1
  • 14
  • 26

On all Arduinos except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is diferentdifferent:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all Arduinos except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is diferent:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all Arduinos except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is different:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all ArduinoArduinos except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is diferent:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • interruptInterrupt 0 -> pinPin 2
  • interruptInterrupt 1 -> pinPin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all Arduino except the DUE, attachInterrupt does not use the pin number as first argument but the interrupt number, which is diferent:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • interrupt 0 -> pin 2
  • interrupt 1 -> pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

On all Arduinos except the DUE, attachInterrupt() does not use the pin number as first argument but the interrupt number, which is diferent:

void attachInterrupt(uint8_t interrupt, void (*ISR)(void), int mode);

As documented on Arduino reference, for an Arduino UNO, the mapping is as follows:

  • Interrupt 0 -> Pin 2
  • Interrupt 1 -> Pin 3

So just change the code in setup() to:

attachInterrupt(0, inter, CHANGE);

And that should work for pin 2.

Source Link
jfpoilpret
  • 9.1k
  • 7
  • 37
  • 54
Loading