Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. /*
  2.   RANDOM AWESOME PIXELS AND TEXT!
  3.   by Justin Rossetti
  4. */
  5.  
  6. #include <RGB_GLCD.h>
  7. GLCD myGLCD;   // Declare an instance of the class
  8.  
  9. void setup()
  10. {
  11.   randomSeed(analogRead(0));
  12.   myGLCD.initLCD();   // Setup the LCD
  13.   // myGLCD.clrScr();    // clear the screen
  14. }
  15.  
  16. void loop()
  17. {
  18.   myGLCD.clrScr();
  19.   int rArray[]={255, 0, 0, 255, 255};
  20.   int gArray[]={0, 255, 0, 255, 255};
  21.   int bArray[]={0, 0, 255, 0, 255};
  22.   int z,r,g,b;
  23.  
  24. // Draw some random pixels
  25. for (z=0; z < 5; z = z+1)
  26.   {
  27.     r = rArray[z];
  28.     g = gArray[z];
  29.     b = bArray[z];
  30.     for (int i=0; i<100; i++)
  31.     {
  32.       myGLCD.setColor(r,g,b);
  33.       myGLCD.drawPixel(random(128), random(128));
  34.     }
  35.   }
  36. // Set up the flashing text
  37.   myGLCD.setColor(0,0,0);
  38.   myGLCD.fillRoundRect(15, 56, 113, 70);
  39.  
  40.   for (int i=0; i<4; i++)
  41.   {
  42.     myGLCD.setColor(255,255,255);
  43.     myGLCD.print("finished.", CENTER, 60);
  44.     delay (750);
  45.     myGLCD.setColor(255,0,0);
  46.     myGLCD.print("finished.", CENTER, 60);
  47.     delay (750);
  48.   }
  49.  
  50.   delay(1000);
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement