Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <Adafruit_NeoPixel.h>
  2. #ifdef __AVR__
  3. #include <avr/power.h>
  4. #endif
  5.  
  6. int PIN = 12;
  7. int NUMPIXELS = 8;
  8. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
  9.  
  10. void setup() {
  11. pinMode(13, OUTPUT);
  12. pinMode(11, OUTPUT);
  13. digitalWrite(11,LOW);
  14. digitalWrite(13,HIGH);
  15. pixels.begin(); // This initializes the NeoPixel library.
  16. Serial.begin(9600);
  17. }
  18. int aux1,aux2, aux3;
  19. int colors[8][3]={{255,0,0},{0,255,0},{0,0,255},{0,255,0},{255,255,0},{0,255,255},{255,0,255},{255,0,0}};
  20. void loop() {
  21. aux1 = colors[7][0];
  22. aux2= colors[7][1];
  23. aux3= colors[7][2];
  24. for( int k = 7; k >0; k --){
  25. for( int l = 0; l < 3; l++){
  26. colors[k][l] = colors[ k - 1][l];
  27. }
  28. }
  29.  
  30. colors[0][0] = aux1;
  31. colors[0][1] = aux2;
  32. colors[0][2] = aux3;
  33.  
  34. for(int i = 0; i < NUMPIXELS; i++){
  35. pixels.setPixelColor(i, pixels.Color(colors[i][0],colors[i][1],colors[i][2]));
  36. pixels.show();
  37. }
  38.  
  39. delay(200);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement