Created
June 5, 2016 21:04
-
-
Save TURBULENTE/bbfde36ecc62f22d3cf32d1c11e731eb to your computer and use it in GitHub Desktop.
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 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