Define data pins and attach interrupts using pin numbers

This commit is contained in:
Adam Goldsmith 2020-03-28 17:08:27 -04:00
parent 90248057d7
commit 34eb7e8add

View File

@ -9,6 +9,10 @@
#include <limits.h>
#include <Keyboard.h>
// DATA pins
#define DATA0 2
#define DATA1 3
// LED pins
#define LED_GREEN 11;
#define LED_RED 12;
@ -42,13 +46,13 @@ void ISR_INT1() {
}
void setup() {
pinMode(2, INPUT); // DATA0 (INT0)
pinMode(3, INPUT); // DATA1 (INT1)
pinMode(DATA0, INPUT);
pinMode(DATA1, INPUT);
Serial.begin(9600);
attachInterrupt(0, ISR_INT0, FALLING);
attachInterrupt(1, ISR_INT1, FALLING);
attachInterrupt(digitalPinToInterrupt(DATA0), ISR_INT0, FALLING);
attachInterrupt(digitalPinToInterrupt(DATA1), ISR_INT1, FALLING);
Keyboard.begin();
}