Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //sunrise to sunset from timing sketch mod 2
- #define FASTLED_INTERNAL
- #include <FastLED.h>
- #include <Wire.h>
- #define NUM_LEDS 3
- #define DATA_PIN 6
- #define pm 7
- int pmstate;
- uint16_t currentPixel = 0;
- uint16_t led = 0;
- byte maxBrightness = 150;
- //----------PALETTES-----------
- DEFINE_GRADIENT_PALETTE (am_gp) {
- 0, 0, 0, 0,
- 18, 98, 0, 0,
- 56, 161, 83, 0,
- 115, 212, 202, 0,
- 179, 255, 253, 213,
- 255, 255, 255, 255
- };
- CRGBPalette16 myPal1 = am_gp;
- struct CRGB leds[NUM_LEDS];
- static uint8_t paletteIndex = 0;
- //------------SETUP-------------
- void setup() {
- FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
- pinMode(pm, INPUT);
- }
- //------------LOOP-------------
- void loop() {
- CRGB colour = ColorFromPalette(myPal1, paletteIndex, maxBrightness, LINEARBLEND);
- fill_solid(leds, NUM_LEDS, colour);
- if (paletteIndex < 255) {
- EVERY_N_MILLISECONDS(100) {
- paletteIndex++;
- FastLED.show();}
- }
- else {
- if (paletteIndex > 0) {
- EVERY_N_MILLISECONDS(100) {
- paletteIndex--;
- FastLED.show();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement