Hello everyone,
This is my first topic here and I hope this is in the right topic.
Now, I would like to control my WS2812B leds with my HC-05 bluetooth module.
This is kind of a problem for me since I do not know much about bluetooth, so I am a total noob. I do kind of understand FastLED, but I do not know how to implement bluetooth control in it. When I know how to do that I might know how to make an app to control the leds with, using App Inventor 2.
Can someone take a look at this working spectrum cycle I made for my leds and maybe explain how to implement bluetooth control in it? Can’t seem to find much information about using bluetooth + FastLED, so all the help I can get is very much appreciated!
Thanks in advance!
Staijn
#include "FastLED.h"
#define NUM_LEDS 30
#define PIN 6
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
int l;
int r;
int g;
int b;
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<LED_TYPE,PIN,COLOR_ORDER>(leds, NUM_LEDS);
}
void loop(){
//ADD RED.. ONLY RED
for(r=0;r<256;r++)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = g;
leds[l].blue = b;
}
delay(30);
}
FastLED.show();
//ADD GREEN, RED AND GREEN
r = 255;
for(g=0;g<256;g++)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = g;
leds[l].blue = b;
}
FastLED.show();
delay(30);
}
//SUBTRACT RED, ONLY GREEN
for(r=255;r>0;r--)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = 255;
leds[l].blue = 0;
}
FastLED.show();
delay(30);
}
//ADD BLUE, GREEN AND BLUE
g = 255;
for(b=0;b<256;b++)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = g;
leds[l].blue = b;
}
FastLED.show();
delay(30);
}
//SUBTRACT GREEN, ONLY BLUE
for(g=255;g>0;g--)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = g;
leds[l].blue = 255;
}
FastLED.show();
delay(30);
}
//ADD RED, RED AND BLUE
for(r=0;r<256;r++)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = g;
leds[l].blue = 255;
}
FastLED.show();
delay(30);
}
//SUBTRACT BLUE, BACK TO RED TO LOOP AGAIN
r = 255;
for(b=255;b>0;b--)
{
for(l=0;l<NUM_LEDS;l++)
{
leds[l].red = r;
leds[l].green = 0;
leds[l].blue = b;
}
FastLED.show();
delay(30);
}
}