I am trying to write a program for ws2811 LEDs. I'm just looking for guidance in the right direction; I have a basic understanding of Arduino and FastLED.
Right now, the startup works. I don't know how to go about receiving the boolean data and then how to set up the if-else statement. I want the program to keep the LEDs one color when receiving 'true' and then blink when it receives a 'false' input. In short, I'm trying to get the LEDs to blink if my Arduino disconnects from Bluetooth.
#define DATA_PIN 3
#define NUM_LEDS 50
#define BRIGHTNESS 64
#define LED_TYPE WS2811
#define COLOR_ORDER BRG
CRGB leds[NUM_LEDS];
#define NUM_BLINK 5 //blink 5 times
void setup()
{
Serial.begin(9600);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
//blink when turned on
for (int i = 0; i < NUM_BLINK; i++)
{
blink1();
}
//then stay solid color
fill_solid(leds, NUM_LEDS, CRGB::Green); //go blue after blinking
FastLED.show();
}//end setup
// receieve boolean value from other code
void connectedLED (bool connectedSTATUS)
{
//if value is true - stay on
if (connectedSTATUS == true)
{
//led strip stay on solid
fill_solid(leds, NUM_LEDS, CRGB::Green);
FastLED.show();
}
//else value is false - blink
else (connectedSTATUS == false);
{
//led strip blink
blink1();
}//end else
}//end void connectedLED
//blink function
void blink1()
{
for (int dot = 0; dot < NUM_BLINK; dot++)
{
fill_solid(leds, NUM_LEDS, CRGB::Blue);
FastLED.show();
delay(200);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
delay(200);
}
}//end blink1
void loop() {
//I am sure that 'connectedLED' should go in 'loop'just not sure how
}//end loop