Created
August 8, 2016 07:28
-
-
Save cirias/62e4069b1023f60a44d6e86080fe57e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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