Skip to content

Instantly share code, notes, and snippets.

@angelaperrone
Created February 8, 2017 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelaperrone/e29c7c00e33d965c0092b30fe7613177 to your computer and use it in GitHub Desktop.
Save angelaperrone/e29c7c00e33d965c0092b30fe7613177 to your computer and use it in GitHub Desktop.
//https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library
//https://github.com/MakerDen/Maker-Den-NETMF/wiki/NeoPixel-Jewel-Setup
//Tom Igoe, in class examples
//http://cdn.sparkfun.com/datasheets/Components/Switches/SC608N-b10k.pdf
//https://github.com/tigoe/NeoPixel_examples/blob/master/NeoPixelFadeAll/NeoPixelFadeAll.ino
//---CODE---\\
// Parameter 1 = # of pixels in strip
//Parameter 2 = pin number
//Parameter 3 = pixel type flags
const int numPixels = 7;
const int neoPixelPin = 6;
const int neoPixelPin2 = 10;
const int neoPixelPin3 = 11;
const int redRead = A5;
const int greenRead = A4;
const int blueRead = A2;
const int red2Read = A1;
const int whiteRead = A3;
const int brightnessRead = A0;
#include <Interval.h>
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip_a = Adafruit_NeoPixel(numPixels, neoPixelPin, NEO_RGBW + NEO_KHZ800);
Adafruit_NeoPixel strip_b = Adafruit_NeoPixel(numPixels, neoPixelPin2, NEO_RGBW + NEO_KHZ800);
Adafruit_NeoPixel strip_c = Adafruit_NeoPixel(numPixels, neoPixelPin3, NEO_RGBW + NEO_KHZ800);
void setup() {
Serial.begin(9600);
strip_a.begin();//initialize strip
strip_b.begin();
strip_c.begin();
strip_a.clear(); //turn off LEDs
strip_b.clear();
strip_c.clear();
strip_a.show(); //initialize pixels to off; not necessary, just thorough
strip_b.show();
strip_c.show();
}
void loop() {
int redSlide = analogRead(redRead);
int greenSlide = analogRead(greenRead);
int blueSlide = analogRead(blueRead);
int red2Slide = analogRead(red2Read);
int whiteSlide = analogRead(whiteRead);
int brightSlide = analogRead (brightnessRead);
int red = map(redSlide, 0, 1023, 0, 255);
int green = map(greenSlide, 0, 1023, 0, 255);
int blue = map(blueSlide, 0, 1023, 0, 255);
int red2 = map(red2Slide, 0, 1023, 0, 255);
int white = map(whiteSlide, 0, 1023, 0, 255);
int brightness = map(brightSlide, 0, 1023, 0, 255);
Serial.println(red);
strip_a.setBrightness(brightness);
strip_b.setBrightness(brightness);
strip_c.setBrightness(brightness);
for (int pixel = 0; pixel < numPixels; pixel++) {
// Serial.print("pixel ");
//Serial.println(pixel);
strip_a.setPixelColor(pixel, green, red, 0, 0);
strip_b.setPixelColor(pixel, 0, red2, blue, 0);
strip_c.setPixelColor(pixel, 0,0,0,white);
}
strip_a.show();
strip_b.show();
strip_c.show();
delay (30);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment