SHARE
TWEET

Untitled

a guest Sep 10th, 2017 157 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <Adafruit_NeoPixel.h>
  3. #ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
  4.  #include <avr/power.h>
  5. #endif
  6.  
  7. #define PIN 13
  8.  
  9. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(12, PIN);
  10.  
  11. uint8_t  mode   = 0, // Current animation effect
  12.          offset = 0; // Position of spinny eyes
  13. uint32_t color  = 0x0036FF; // Start red
  14. uint32_t prevTime;
  15.  
  16. void setup() {
  17. #ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
  18.   if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
  19. #endif
  20.   pixels.begin();
  21.   pixels.setBrightness(55); // 1/3 brightness
  22.   prevTime = millis();
  23. }
  24.  
  25. void loop() {
  26.   uint8_t  i;
  27.   uint32_t t;
  28.  
  29. // Spinny wheels (8 LEDs on at a time)
  30.     for(i=0; i<12; i++) {
  31.       uint32_t c = 0;
  32.       if(((offset + i) & 7) < 2) c = color; // 4 pixels on...
  33.       pixels.setPixelColor(   i, c); // First eye
  34.     }
  35.     pixels.show();
  36.     offset++;
  37.     delay(100);
  38.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top