Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #ifdef __AVR__
- #include <avr/power.h>
- #endif
- #define PIN 6
- #define NUMPIXELS 16
- Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
- #define PIN_R 2
- #define PIN_G 3
- #define PIN_B 4
- int red_in;
- int green_in;
- int blue_in;
- void setup() {
- // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
- #if defined (__AVR_ATtiny85__)
- if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
- #endif
- // End of trinket special code
- pixels.begin(); // This initializes the NeoPixel library.
- }
- void loop() {
- red_in = digitalRead(PIN_R);
- green_in = digitalRead(PIN_G);
- blue_in = digitalRead(PIN_B);
- for(int i=0;i<NUMPIXELS;i++){
- pixels.setPixelColor(i, pixels.Color(150*red_in, 150*green_in, 150*blue_in));
- pixels.show(); // This sends the updated pixel color to the hardware.
- }
- }
Add Comment
Please, Sign In to add comment