Advertisement
Guest User

Untitled

a guest
Oct 14th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. void dropLines(int wait) {
  2.   if(newDropline == true) {
  3.     matrix.clear();
  4.     m_X = 16;
  5.     m_Y = 0;
  6.     newDropline = false;
  7.   }
  8.   if(millis() % wait == 0) {
  9.  
  10.     matrix.drawLine(0,m_Y,8,m_Y,1);
  11.     matrix.drawLine(0,m_Y-1,8,m_Y-1,0);
  12.     matrix.writeDisplay();
  13.     m_Y++;
  14.     if(m_Y == m_X) {
  15.       m_X--;
  16.       m_Y = 0;
  17.     }
  18.     if(m_X == 0) {
  19.       newDropline = true;
  20.     }
  21.   }
  22.  
  23. }
  24.  
  25. void rainbowstack(int wait) {
  26.   if(newStack == true) {
  27.     clear_strip();
  28.     stackHeight = 16;
  29.     newStack = false;
  30.     yPos = 0;
  31.   }
  32.   if(millis() % wait == 0) {
  33.  
  34.     leds[yPos].setHue(map(yPos,0,15,0,255));
  35.     leds[yPos-1].setRGB(0,0,0);
  36.     leds[31-yPos] = leds[yPos];
  37.     leds[31-(yPos-1)].setRGB(0,0,0);
  38.     LEDS.show();
  39.     yPos++;
  40.    
  41.     if(yPos == stackHeight) {
  42.       stackHeight--;
  43.       yPos = 0;
  44.     }
  45.  
  46.     if(stackHeight == 0) {
  47.       newStack = true;
  48.     }
  49.    
  50.   }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement