Hello,
i have a Project where i need to Controll a LED Light, i want to make this i a menu tab (case). See Code for Problems
Thanks
#define BLYNK_PRINT Serial
#define NUM_LEDS 10
#define PIN D6
#define FASTLED_ESP8266_RAW_PIN_ORDER /* pin mapping for nodemcu v1.0 esp8266 */
#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#define FASTLED_ESP8266_D1_PIN_ORDER
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Blynk.h>
#include <FastLED.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "auth token";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ssid";
char pass[] = "password";
CRGB leds[NUM_LEDS];
void setup()
{
FastLED.addLeds<WS2812B, PIN, RGB>(leds, NUM_LEDS);
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,1), 8080);
}
BLYNK_WRITE(V3) {
switch (param.asInt())
{
case 1: // Solo
BLYNK_WRITE(V1){
int G = param[0].asInt();
int R = param[1].asInt();
int B = param[2].asInt();
for(int i=0;i<NUM_LEDS;i++){
leds[i].setRGB( R, G, B);
FastLED.show();
}
}
break;
case 2: // Dual
for(int i=0;i<NUM_LEDS;i++){
leds[i].setRGB( 255, 0, 0);
FastLED.show();
break;
}
}
BLYNK_WRITE(V2){ /* Brightness */
int Brightness = param.asInt();
FastLED. setBrightness( Brightness );
FastLED.show();
}
void loop()
{
Blynk.run();
}