a guest Apr 18th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static int TeamScore = 0;
  2. if(Serial2.available())
  3.   {
  4.     char incoming = (char);
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand