SHARE
TWEET

ElectronicHandbagProject1

a guest Mar 1st, 2014 239 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Adafruit_NeoPixel.h>
  2. // 24 Feb 2014 DMc
  3. #define PIN 1
  4.  
  5. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(4, PIN);
  6.  
  7. uint32_t color1  = 0xff0000, // red
  8.          color2 = 0x00ff00, // green
  9.          color3 = 0x0000ff; // blue
  10.  
  11. void setup() {
  12.   pixels.begin();
  13.   pixels.setBrightness(85);
  14. }
  15.  
  16. void loop() {
  17.     pixels.setPixelColor(0, color1);
  18.     pixels.setPixelColor(1, color2);
  19.     pixels.setPixelColor(2, color3);
  20.     pixels.setPixelColor(3, color1);
  21.     pixels.show();
  22.     delay(200);
  23.     pixels.setPixelColor(0, 0);
  24.     pixels.setPixelColor(1, 0);
  25.     pixels.setPixelColor(2, 0);
  26.     pixels.setPixelColor(3, 0);
  27.     pixels.show();
  28.     delay(400);
  29.     pixels.setPixelColor(0, color2);
  30.     pixels.setPixelColor(1, color3);
  31.     pixels.setPixelColor(2, color1);
  32.     pixels.setPixelColor(3, color2);
  33.     pixels.show();
  34.     delay(200);
  35.     pixels.setPixelColor(0, 0);
  36.     pixels.setPixelColor(1, 0);
  37.     pixels.setPixelColor(2, 0);
  38.     pixels.setPixelColor(3, 0);
  39.     pixels.show();
  40.     delay(400);
  41.     pixels.setPixelColor(0, color3);
  42.     pixels.setPixelColor(1, color1);
  43.     pixels.setPixelColor(2, color2);
  44.     pixels.setPixelColor(3, color3);
  45.     pixels.show();
  46.     delay(200);
  47.     pixels.setPixelColor(0, 0);
  48.     pixels.setPixelColor(1, 0);
  49.     pixels.setPixelColor(2, 0);
  50.     pixels.setPixelColor(3, 0);
  51.     pixels.show();
  52.     delay(400);
  53. }
RAW Paste Data
Top