Last active
August 15, 2016 19:19
-
-
Save j0uni/ab6371596c7f52838852a8a3ca195033 to your computer and use it in GitHub Desktop.
Futaba SBUS latency test with Arduino Mega
This file contains 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
void setup() | |
{ | |
Serial.begin(115200); | |
Serial3.begin(100000); | |
pinMode(13, OUTPUT); | |
} | |
uint8_t buffer[255]; | |
uint8_t bufferPos=0; | |
void loop() | |
{ | |
while (Serial3.available()) | |
{ | |
uint8_t c=Serial3.read(); | |
// a terrible hack, but works! | |
// it just monitors if the first channel is different than "normally" | |
if (c==0x0f) | |
{ | |
digitalWrite(13, (buffer[1]!=96)); | |
bufferPos=0; | |
} | |
buffer[bufferPos] = c; | |
bufferPos++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment