Define data pins and attach interrupts using pin numbers
This commit is contained in:
parent
90248057d7
commit
34eb7e8add
@ -9,6 +9,10 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <Keyboard.h>
|
#include <Keyboard.h>
|
||||||
|
|
||||||
|
// DATA pins
|
||||||
|
#define DATA0 2
|
||||||
|
#define DATA1 3
|
||||||
|
|
||||||
// LED pins
|
// LED pins
|
||||||
#define LED_GREEN 11;
|
#define LED_GREEN 11;
|
||||||
#define LED_RED 12;
|
#define LED_RED 12;
|
||||||
@ -42,13 +46,13 @@ void ISR_INT1() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(2, INPUT); // DATA0 (INT0)
|
pinMode(DATA0, INPUT);
|
||||||
pinMode(3, INPUT); // DATA1 (INT1)
|
pinMode(DATA1, INPUT);
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
attachInterrupt(0, ISR_INT0, FALLING);
|
attachInterrupt(digitalPinToInterrupt(DATA0), ISR_INT0, FALLING);
|
||||||
attachInterrupt(1, ISR_INT1, FALLING);
|
attachInterrupt(digitalPinToInterrupt(DATA1), ISR_INT1, FALLING);
|
||||||
|
|
||||||
Keyboard.begin();
|
Keyboard.begin();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user