Hallo,
hope someone can help
First of all - what I want to do:
Blynk: 2 Buttons (Switch Mode) + 1 Slider (0-255)
I got a Blue Button, that turns on or off the Blue leds and a Red Button that turns on or off the Red Leds.
If the the Blue one is on, the Red is off otherwise.
with the Slider I only want to controll the Brightnes of the Led Strip, but I can´t sync the Slider with the Virtual Pins.
V40 = Slider
V1 = Blue
V2 = Red
V10 = Display Widget
> #include <FastLED.h>
> #include <ESP8266WiFi.h>
> #include <BlynkSimpleEsp8266.h>
>
> #define BLYNK_PRINT Serial
> #define NUM_LEDS 12
> #define DATA_PIN 4
> #define CLOCK_PIN 13
>
> CRGB leds[NUM_LEDS];
>
> char auth[] = "744d992b36c94c448e86xxxxxx";
> char ssid[] = "xxxx";
> char pass[] = "xxxxxx";
> char server[] = "xxx.xxx.xxx.xx";
>
> int ledBrightnes = 164;
>
> void setup()
> {
> Serial.begin(9600);
> Blynk.begin(auth, ssid, pass, server);
> FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
> }
>
> BLYNK_WRITE(V40)
> {
> int pinValue = param.asInt();
> ledBrightnes = pinValue;
> Serial.println(ledBrightnes);
> }
>
>
> BLYNK_WRITE(V1)
> {
> int pinValue = param.asInt();
> Serial.println(pinValue);
>
> if (pinValue == 1)
> {
> fill_gradient(leds,0,CHSV(10,255,ledBrightnes),11,CHSV(30,255,ledBrightnes),SHORTEST_HUES);
> Blynk.virtualWrite(V2, 0);
> Blynk.virtualWrite(V10, "Rot an");
> Blynk.virtualWrite(V11, ledBrightnes);
> FastLED.show();
> }
>
> if (pinValue == 0)
> {
> fill_gradient(leds,0,CHSV(90,255,0),11,CHSV(120,255,0),SHORTEST_HUES);
> FastLED.show();
> Blynk.virtualWrite(V2, 0);
> Blynk.virtualWrite(V10, "Lichter aus");
> }
> }
>
> BLYNK_WRITE(V2)
> {
> int pinValue = param.asInt();
> Serial.println(pinValue);
>
> if (pinValue == 1)
> {
> fill_gradient(leds,0,CHSV(110,255,255),11,CHSV(130,255,255),SHORTEST_HUES);
> FastLED.show();
> Blynk.virtualWrite(V1, 0);
> Blynk.virtualWrite(V10, "Blau an");
> }
>
> if (pinValue == 0)
> {
> fill_gradient(leds,0,CHSV(90,255,0),11,CHSV(120,255,0),SHORTEST_HUES);
> FastLED.show();
> Blynk.virtualWrite(V1, 0);
> Blynk.virtualWrite(V10, "Lichter aus");
> }
>
> }
>
> void loop()
> {
> Blynk.run();
> }