SHARE
TWEET

Main Function

ChipSkylarkk Jun 16th, 2013 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void loop()
  2. {
  3.   digitalWrite(latch1, LOW);
  4.   shiftOut(data1, clock1, MSBFIRST, ~digitOne[player1Points]);
  5.   shiftOut(data1, clock1, MSBFIRST, ~digitTwo[player2Points]);
  6.   digitalWrite(latch1, HIGH);
  7.  
  8.   if(player1Points >= score)
  9.   {
  10.     player1Celebrate();
  11.   }
  12.  
  13.   if(player2Points >= score)
  14.   {
  15.     player2Celebrate();
  16.   }
  17.  
  18.   int val = analogRead(pot);
  19.   val = map(val, 0, 1023, 1, 100);
  20.  
  21.   if(flag == 'F')
  22.   {
  23.     chaseForward(strip.Color(127, 0, 0), val);
  24.   }
  25.   if(flag == 'R')
  26.   {
  27.     chaseReverse(strip.Color(0, 0, 127), val);
  28.   }
  29.  
  30.   int AbuttonState = digitalRead(player1);
  31.   if(AbuttonState == LOW && turn == 'A' && flag != 'F' && flag != 'R')
  32.   {
  33.     i = 0;
  34.    
  35.     //Turns off player 1 LEDs
  36.     digitalWrite(latch2, LOW);
  37.     shiftOut(data2, clock2, MSBFIRST, 255);  
  38.     digitalWrite(latch2, HIGH);
  39.    
  40.   chaseForward(strip.Color(0, 127, 0), val); // White
  41.   }
  42.  
  43.   int BbuttonState = digitalRead(player2);
  44.   if(BbuttonState == LOW && turn == 'B' && flag != 'F' && flag != 'R')
  45.   {
  46.     i = 30;
  47.    
  48.     //Turns off player 2 LEDs
  49.     digitalWrite(latch3, LOW);
  50.     shiftOut(data3, clock3, MSBFIRST, 255);  
  51.     digitalWrite(latch3, HIGH);
  52.    
  53.   chaseReverse(strip.Color(127,   0,   127), val); // Red
  54.   }
  55. }
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