Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #include <avr/power.h>
- #ifdef __AVR__
- #endif
- #define PIN 6
- #define NUMPIXELS 24 // Popular NeoPixel ring size
- Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
- #define DELAYVAL 100
- void setup() {
- #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
- clock_prescale_set(clock_div_1);
- #endif
- pixels.begin();
- }
- void loop() {
- while (1) {
- pixels.show();
- for(int i=0; i<NUMPIXELS; i++) {
- pixels.setPixelColor(i, pixels.Color(255, 0, 0));
- pixels.show();
- delay(DELAYVAL);
- }
- pixels.show();
- for(int i=23; i<NUMPIXELS; i--) {
- pixels.setPixelColor(i, pixels.Color(0, 0, 255));
- pixels.show();
- delay(DELAYVAL);
- }
- }
- }
Add Comment
Please, Sign In to add comment