Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. static int TeamScore = 0;
  2. if(Serial2.available())
  3. {
  4. char incoming = (char)Serial2.read();
  5. 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
  6. {
  7. TeamScore += ((int)incoming * 10); //According to the IDC document each pair detection is 10 points, so that's why the x10 is there.
  8. }
  9. else if(incoming == 'S') //snitch
  10. {
  11. TeamScore += 150;
  12. }
  13. // insert else if for your pair's characters here
  14. }
  15. //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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement