Skip to content

Instantly share code, notes, and snippets.

@TomMinor
Created January 16, 2015 13:19
Show Gist options
  • Save TomMinor/0b6cf6b93f3f3c3c8cfc to your computer and use it in GitHub Desktop.
Save TomMinor/0b6cf6b93f3f3c3c8cfc to your computer and use it in GitHub Desktop.
if(Serial.available() >= 4)
{
Header = Serial.read()
// check header
PacketInfo = Serial.read();
Payload = Serial.read();
Footer = Serial.read();
while(Serial.available())
{
Serial.read(); // Flush extra bytes
}
Byte chksum = generateCheckshum(Header, PacketInfo, Payload, Footer);
Serial.write(chksum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment