Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #ifdef __AVR__
- #include <avr/power.h>
- #endif
- int PIN = 12;
- int NUMPIXELS = 8;
- Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
- void setup() {
- pinMode(13, OUTPUT);
- pinMode(11, OUTPUT);
- digitalWrite(11,LOW);
- digitalWrite(13,HIGH);
- pixels.begin(); // This initializes the NeoPixel library.
- Serial.begin(9600);
- }
- int aux1,aux2, aux3;
- 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}};
- void loop() {
- aux1 = colors[7][0];
- aux2= colors[7][1];
- aux3= colors[7][2];
- for( int k = 7; k >0; k --){
- for( int l = 0; l < 3; l++){
- colors[k][l] = colors[ k - 1][l];
- }
- }
- colors[0][0] = aux1;
- colors[0][1] = aux2;
- colors[0][2] = aux3;
- for(int i = 0; i < NUMPIXELS; i++){
- pixels.setPixelColor(i, pixels.Color(colors[i][0],colors[i][1],colors[i][2]));
- pixels.show();
- }
- delay(200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement