Skip to content

Instantly share code, notes, and snippets.

@cirias
Created August 8, 2016 07:28
#include "PinChangeInterrupt.h"
// Choose a valid PinChangeInterrupt pin of your Arduino board
#define pcintThrottle 12 // A4
#define pcintAileron 13 // A5
void rising1(void);
void falling1(void);
void rising2(void);
void falling2(void);
void rising1(void) {
Serial.println("rising1");
attachPCINT(pcintThrottle, falling1, FALLING);
}
void falling1(void) {
Serial.println("falling1");
attachPCINT(pcintThrottle, rising1, RISING);
}
void rising2(void) {
Serial.println("rising2");
attachPCINT(pcintThrottle, falling2, FALLING);
}
void falling2(void) {
Serial.println("falling2");
attachPCINT(pcintThrottle, rising2, RISING);
}
void setup() {
// set pin to input with a pullup, led to output
pinMode(pcintThrottle, INPUT_PULLUP);
// Attach the new PinChangeInterrupt and enable event function below
attachPCINT(pcintThrottle, rising1, RISING);
attachPCINT(pcintAileron, rising2, RISING);
Serial.begin(115200);
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment