Hello!
I am trying the LoopBack example on Teensy 3.2 and Arduino 1.8.5 OSX. I downloaded the newest version from GitHub but still it won't work. There is nothing popping up in the serial console.
I want to READ from a RC receiver and with another, easy interrupt based example like this:
It works! So no electrical issue. Any idea where to start debugging?
I am trying the LoopBack example on Teensy 3.2 and Arduino 1.8.5 OSX. I downloaded the newest version from GitHub but still it won't work. There is nothing popping up in the serial console.
I want to READ from a RC receiver and with another, easy interrupt based example like this:
Code:
// Define which pin we’re using to accept the signal
#define RCPIN 1
// We have to declare as volatile as this will be modified
// by the interrupt routine, and read outside of it
volatile uint16_t channel;
uint16_t channel_start;
void setup() {
Serial.begin(115200);
Serial.println("Starting…");
// Mark the pin as an INPUT
pinMode(RCPIN, INPUT);
// Attach an interrupt handler to be called whenever
// the pin changes from LOW to HIGH or vice versa
attachInterrupt(RCPIN, RCchannel, CHANGE);
}
void loop() {
// Output the channel value
Serial.print("RC channel:\t");
Serial.println(channel);
delay(50);
}
void RCchannel() {
// If the pin is HIGH, start a timer
if (digitalRead(RCPIN) == HIGH) {
channel_start = micros();
} else {
// The pin is now LOW so output the difference
// between when the timer was started and now
channel = (uint16_t) (micros() – channel_start);
}
}
It works! So no electrical issue. Any idea where to start debugging?