Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS 50
- #define LED_PIN 5
- #define BRIGHTNESS 75
- #define LED_TYPE NEOPIXEL
- #define COLOR_ORDER GRB
- #define UPDATES_PER_SECOND 75
- CRGB ledStrip[NUM_LEDS];
- CRGBPalette16 currentPalette;
- TBlendType currentBlending;
- const int pin12 = 12;
- const int pin11 = 11;
- const int pin10 = 10;
- const int pin9 = 9;
- const int pin8 = 8;
- const int pin7 = 7;
- const int pin6 = 6;
- const int pin5 = 5;
- void setup() {
- // put your setup code here, to run once:
- delay(3000);
- FastLED.addLeds<LED_TYPE, LED_PIN>(ledStrip, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- currentPalette = RainbowStripeColors_p;
- currentBlending = NOBLEND;
- pinMode(pin12, INPUT_PULLUP);
- pinMode(pin11, INPUT_PULLUP);
- pinMode(pin10, INPUT_PULLUP);
- }
- void StripFill (CRGB color, uint8_t from, uint8_t to) {
- for (uint8_t i = from; i <= to; i++) {
- ledStrip[i] = color;
- }
- }
- /*void leftStripWipe {
- for(int i = NUM_LEDS; i++) {
- ledStrip[i] = CRGB::Red;
- FastLED.show();
- ledStrip[i] = CRGB::Red;
- FastLED.show();
- delay(5);
- }
- }*/
- void loop() {
- // put your main code here, to run repeatedly:
- int d12 = digitalRead(pin12);
- int d11 = digitalRead(pin11);
- int d10 = digitalRead(pin10);
- if (d12 == 1 && d11 == 1 && d10 == 1) {
- StripFill(CRGB::Black, 0, 50);
- FastLED.show();
- }
- if (d12 == 0) {
- for (int i = 0; i < NUM_LEDS; i++) {
- ledStrip[i] = CRGB::Red;
- FastLED.show();
- ledStrip[i] = CRGB::Red;
- FastLED.show();
- }
- if (d10 == 0) {
- for(int i = NUM_LEDS-1; i >= 0; i--)
- ledStrip[i] = CRGB::Blue;
- FastLED.show();
- ledStrip[i] = CRGB::Blue;
- FastLED.show();
- delay(5);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement