Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.72 KB | None | 0 0
  1. const int ARRAY_SIZE = 8; // Base Array sizes are always 1 bigger than the actual content of the array.  The "extra" is a termination/null character
  2. int VARIABLES[ARRAY_SIZE]={ circuit1,circuit2,circuit3,circuit4,circuit5,circuit6,status }
  3.  
  4. void ledupdate() {
  5.     for (int i=0; i<ARRAY_SIZE; i++) {
  6.         switch(VARIABLES[i]) {
  7.             case 0:
  8.                 batterypixels.setPixelColor(i, batterypixels.Color(0, 0, 0));
  9.                 break;
  10.             case 1:
  11.                 batterypixels.setPixelColor(i, batterypixels.Color(0, 10, 0));
  12.                 break;    
  13.             case 2:
  14.                 batterypixels.setPixelColor(i, batterypixels.Color(10, 10, 0));
  15.                 break;    
  16.             case 3:
  17.                 batterypixels.setPixelColor(i, batterypixels.Color(10, 0, 0));
  18.                 break;
  19.         }
  20.     }
  21.     batterypixels.show();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement