Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Include FastLED.h
- #include <FastLED.h>
- //define numbers of led
- #define NUM_LEDS 5
- //define the pin which is connectet to the strip
- #define DATA_PIN 6
- //define our led array
- CRGB leds[NUM_LEDS];
- void setup() {
- // define strip type
- delay(2000);
- FastLED.addLeds<WS2812B, DATA_PIN, BRG>(leds, NUM_LEDS);
- }
- void loop() {
- // set all leds to red
- leds[0] = CRGB::Red;
- leds[1] = CRGB::Red;
- leds[2] = CRGB::Red;
- leds[3] = CRGB::Red;
- leds[4] = CRGB::Red;
- FastLED.show();
- // change brightness from 30 up to 255
- for(int j=30;j<256;j++)
- {
- FastLED.setBrightness(j);
- FastLED.show();
- delay(10);
- }
- // change brightness from 255 down to 30
- for(int j=255;j>30;j--)
- {
- FastLED.setBrightness(j);
- FastLED.show();
- delay(10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment