Lumenati Alien Garden
Contributors:
Dia
Upload the Code
Plug the RedBoard or microcontroller of choice into your computer. Open the Arduino IDE, copy the sketch below, and upload the code to the board. Please note that this example uses the FastLED library. You will need to have it installed for this sketch to work. You can find the latest version here. Alternatively, you can search for the 'fastled' in the Library Manger and install it that way.
language:c
#include "FastLED.h"
//Number of LEDs; edit this if you've added more boards or changed the sizes
#define NUM_LEDS 16
//Define our clock and data lines
#define DATA_PIN 11
#define CLOCK_PIN 13
//Create the LED array
CRGB leds[NUM_LEDS];
void setup() {
//Tell FastLED what we're using. Note "BGR" where you might normally find "RGB".
//This is just to rearrange the order to make all the colors work right.
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, BGR>(leds, NUM_LEDS);
//Set colors for all of the LEDs; Fast LED has a HUGE selection of colors, so
//browse through them and find the best matches for your plants.
leds[0] = CRGB::DeepPink; // First Flower
leds[1] = CRGB::Teal; //
leds[2] = CRGB::DeepPink; //
leds[3] = CRGB::Teal; //
leds[4] = CRGB::Purple; // Second Flower
leds[5] = CRGB::Green; //
leds[6] = CRGB::Purple; //
leds[7] = CRGB::DarkGreen; //
leds[8] = CRGB::Blue; // Third Flower
leds[9] = CRGB::Green; //
leds[10] = CRGB::Purple; //
leds[11] = CRGB::DarkGreen; //
leds[12] = CRGB::Purple; //
leds[13] = CRGB::Green; //
leds[14] = CRGB::Purple; //
leds[15] = CRGB::DarkGreen; //
//Set global brightness
FastLED.setBrightness(50);
FastLED.show();
}
void loop() {
// set the length for delays and initial brightness for each flower
uint8_t x;
uint16_t wait = 50;
uint8_t flower1 = 75;
uint8_t flower2 = 255;
uint8_t flower3 = 75;
//To bring them to life, I'm dimming and brightening the LEDs to make them "pulse"
//a little bit. Flower1 will get progressively brighter, while Flower2 gets dimmer.
while (flower1 < 255)
{
flower1++;
flower2--;
leds[0].setHSV( 192, 255 , flower1 );
leds[1].setHSV( 96, 255 , flower1 );
leds[2].setHSV( 192, 255 , flower1 );
leds[3].setHSV( 96, 255 , flower1 );
leds[4].setHSV( 192, 255 , flower2 );
leds[5].setHSV( 96, 255 , flower2 );
leds[6].setHSV( 192, 255 , flower2 );
leds[7].setHSV( 96, 255 , flower2 );
FastLED.show();
delay (wait);
}
//Once flower1 is at max brightness, they'll reverse, and flower1 will grow dimmer
//while flower2 grows brighter.
while (flower1 > 75)
{
flower1--;
flower2++;
leds[0].setHSV( 192, 255 , flower1 );
leds[1].setHSV( 96, 255 , flower1 );
leds[2].setHSV( 192, 255 , flower1 );
leds[3].setHSV( 96, 255 , flower1 );
leds[4].setHSV( 192, 255 , flower2 );
leds[5].setHSV( 96, 255 , flower2 );
leds[6].setHSV( 192, 255 , flower2 );
leds[7].setHSV( 96, 255 , flower2 );
FastLED.show();
delay (wait);
}
FastLED.show();
delay(wait);
}