lichterKette/lichterKette.ino

54 lines
1.2 KiB
Arduino
Raw Normal View History

2015-12-03 11:03:49 +00:00
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
2015-12-03 11:11:18 +00:00
//Important: Set the number of LEDs here!!!
2015-12-03 11:03:49 +00:00
#define PIN 6
#define NUMPIXELS 22
2015-12-03 11:11:18 +00:00
//Create the object representation of our strip
2015-12-03 11:03:49 +00:00
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
2015-12-03 11:11:18 +00:00
//Some usefull variables and buffers, currently not all in use
2015-12-03 11:03:49 +00:00
unsigned long previousMillis = 0;
unsigned long interval = 0;
int mode = 0;
int element = 0;
int colorval1 = 0;
int colorval2 = 0;
int colorval3 = 0;
void setup() {
pixels.begin();
}
void loop() {
if(element<NUMPIXELS)
element++;
else
element = 0;
for(int i = 0; i < NUMPIXELS; i++){
2015-12-03 11:11:18 +00:00
//Set the color values for all leds as pixels.Color(G,R,B);
2015-12-03 11:03:49 +00:00
pixels.setPixelColor(i,pixels.Color(((i==element)?255 :0),((i==element)?0:0),((i==element)?0:255))); // Moderately bright green color.
}
/*
for(int i = 0; i < NUMPIXELS; i++){
if(i%2)pixels.setPixelColor(i,pixels.Color(0,0,255));
else pixels.setPixelColor(i,pixels.Color(255,0,0));
}
*/
2015-12-03 11:11:18 +00:00
//this sends the data from our object to the actuall strip
2015-12-03 11:03:49 +00:00
pixels.show();
delay(200);
}