Skip to content

Instantly share code, notes, and snippets.

@TURBULENTE
Created June 5, 2016 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TURBULENTE/bbfde36ecc62f22d3cf32d1c11e731eb to your computer and use it in GitHub Desktop.
Save TURBULENTE/bbfde36ecc62f22d3cf32d1c11e731eb to your computer and use it in GitHub Desktop.
void read_data(){
while (myPort.available() > 0) { // If data is available
byte1 = byte2;
byte2 = byte3;
byte3 = byte4;
byte4 = low;
low = high;
high = myPort.read();
if ((byte1 == 1) & (byte2 == 2) & (byte3 ==
3) & (byte4 == 4)){ // Filter out the framing numbers: 1,2,3,4
value = (256*high + low);
println("THE VALUE IS " + value); //print to the screen
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment