SHARE
TWEET

chaseForward

ChipSkylarkk Jun 20th, 2013 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void chaseForward(uint32_t c, uint8_t wait)
  2. {
  3.   lcd.clear();
  4.  
  5.   for(i; i < 30; i++)
  6.   {
  7.     if(digitalRead(player2) == LOW)
  8.     {
  9.       cheat = 'Y';
  10.     }
  11.     strip.setPixelColor(i, c); // Set new pixel 'on'
  12.     strip.show();              // Refresh LED states
  13.     strip.setPixelColor(i, 0); // Erase pixel, but don't refresh!
  14.     delay(wait);
  15.    
  16.     if(i > 27 && cheat != 'Y')
  17.     {
  18.       int BbuttonState = digitalRead(player2);
  19.       if(BbuttonState == LOW)
  20.       {
  21.         turn = 'B';
  22.         flag = 'R';
  23.         return;
  24.       }
  25.     }
  26.   }
  27.   player1Points++;
  28.   digitalWrite(latch1, LOW);
  29.   shiftOut(data1, clock1, MSBFIRST, ~digitOne[player1Points]);
  30.   shiftOut(data1, clock1, MSBFIRST, ~digitTwo[player2Points]);
  31.   digitalWrite(latch1, HIGH);
  32.   if(player1Points < score)
  33.   lcd.print("PLAYER 1 SCORES!");
  34.   strip.show();
  35.  
  36.   //Turn on player1 LEDs
  37.   digitalWrite(latch2, LOW);
  38.   shiftOut(data2, clock2, MSBFIRST, 0);  
  39.   digitalWrite(latch2, HIGH);
  40.  
  41.   flag = 'S';
  42.   cheat = 'N';
  43. }
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
 
Top