Advertisement
ChipSkylarkk

shift1

Jun 24th, 2013
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.39 KB | None | 0 0
  1. /*
  2. int wait = 200; //replace with timer inturrupt??
  3.  
  4. //if button is pressed 'return'
  5.  
  6. if (player1==HIGH)
  7. {
  8.   //cycle through leds
  9.   //digitalread after each delay
  10. }
  11.  
  12. //Do this eventually
  13. while (digitalRead(player1) == HIGH)
  14.   //if (digitalRead(player1) == HIGH)
  15.   {
  16.     digitalWrite(latch2, LOW);
  17.     shiftOut(data2, clock2, MSBFIRST, 127);  
  18.     digitalWrite(latch2, HIGH);
  19.     delay(wait);                    //replace with timer inturrupt??
  20.     digitalWrite(latch2, LOW);
  21.     shiftOut(data2, clock2, MSBFIRST, 191);  
  22.     digitalWrite(latch2, HIGH);
  23.     delay(wait);
  24.     digitalWrite(latch2, LOW);
  25.     shiftOut(data2, clock2, MSBFIRST, 199);  
  26.     digitalWrite(latch2, HIGH);
  27.     delay(wait);
  28.     digitalWrite(latch2, LOW);
  29.     shiftOut(data2, clock2, MSBFIRST, 249);  
  30.     digitalWrite(latch2, HIGH);
  31.     delay(wait);
  32.     digitalWrite(latch2, LOW);
  33.     shiftOut(data2, clock2, MSBFIRST, 254);  
  34.     digitalWrite(latch2, HIGH);
  35.     delay(wait);
  36.   }
  37.   int i;
  38.   //for (i=0;i<1000;i++)
  39.   //{
  40.  
  41.   digitalWrite(latch2, LOW);
  42.   shiftOut(data2, clock2, MSBFIRST, 255);  
  43.   digitalWrite(latch2, HIGH);
  44.   delay(300);
  45.  
  46.   //}
  47.  
  48.   hey(); //replace with return? So we can exit the function?
  49. }
  50.  
  51. void hey() //turns on all LEDs
  52. { int i;
  53.   for (i=0;i<1000;i++)
  54.   {
  55.   digitalWrite(latch2, LOW);
  56.   shiftOut(data2, clock2, MSBFIRST, 0);  
  57.   digitalWrite(latch2, HIGH);
  58.   }
  59. }
  60.  
  61.  
  62.  
  63. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement