Last active
April 8, 2019 17:09
-
-
Save jimmyjxiao/893c5d064e96ba9dfd5397893e06f27e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| static int TeamScore = 0; | |
| if(Serial2.available()) | |
| { | |
| char incoming = (char)Serial2.read(); | |
| if(incoming < 15) // chars under decimal 15 do not map to useful ASCII characters so we should be fine using them to send/receive pair scores | |
| { | |
| TeamScore += ((int)incoming * 10); //According to the IDC document each pair detection is 10 points, so that's why the x10 is there. | |
| } | |
| else if(incoming == 'S') //snitch | |
| { | |
| TeamScore += 150; | |
| } | |
| // insert else if for your pair's characters here | |
| } | |
| //don't forget to account for the fact that is you are the one in your pair sending your pair score then you won't be receiving it into the loop above so you need to manually add it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment