Example 1: blynk rgb led strip
#define pinRED 3
#define pinGREEN 5
#define pinBLUE 6
#define flag_esp 11
int value_red_esp;
int value_green_esp;
int value_blue_esp;
int red_esp;
int green_esp;
int blue_esp;
int value_red;
int value_green;
int value_blue;
int on_signal_esp;
int brightness_red;
int brightness_green;
int brightness_blue;
int red_color;
int blue_color;
int green_color;
void setup() {
// put your setup code here, to run once:
pinMode(pinRED, OUTPUT);
pinMode(pinGREEN, OUTPUT);
pinMode(pinBLUE, OUTPUT);
pinMode(flag_esp,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
value_red_esp= analogRead(A0);
value_green_esp= analogRead(A1);
value_blue_esp= analogRead(A2);
red_esp= map(value_red_esp, 0, 673, 0, 255);
green_esp= map(value_green_esp, 0, 673, 0, 255);
blue_esp= map(value_blue_esp, 0, 673, 0, 255);
if( red_esp >= 254){
red_esp = 255;
}
if( green_esp >= 254){
green_esp = 255;
}
if( blue_esp >= 254){
blue_esp = 255;
}
on_signal_esp = digitalRead(flag_esp);
if( (on_signal_esp == 0)){
red_color=0;
blue_color=0;
green_color=0;
}
else if ((on_signal_esp == 1)){
red_color=red_esp;
blue_color=blue_esp;
green_color=green_esp;
}
analogWrite(pinRED, red_color);
analogWrite(pinGREEN, green_color);
analogWrite(pinBLUE, blue_color);
Serial.print(on_signal_esp);
Serial.print(" ");
Serial.print(red_esp);
Serial.print(" ");
Serial.print(green_esp);
Serial.print(" ");
Serial.println(blue_esp);
}
Example 2: blynk rgb led strip
on_signal_esp = digitalRead(flag_esp);
if( (on_signal_esp == 0)){
red_color=0;
blue_color=0;
green_color=0;
}
else if ((on_signal_esp == 1)){
red_color=red_esp;
blue_color=blue_esp;
green_color=green_esp;
Example 3: blynk rgb led strip
/*************************************************************************
* Title: Simple ESP-8266 Wifi RGB LED Strip Light Controller
* File: esp8266_rgb_led_controller.ino
* Author: James Eli
* Date: 1/14/2018
*
* Blynk slider #1 (r) GPIO14
* Blynk slider #2 (g) GPIO05
* Blynk slider #3 (b) GPIO12
*
* This program controls an RGB LED strip light.
*
* Notes:
* (1) Requires the following arduino libraries:
* ESP8266
* (2) Compiled with arduino ide 1.8.3
* (4) To place an ESP8266 into program mode, GPIO0 must be LOW during power up.
* (5) Test Pads on PCB back:
* #1 – GND
* #2 – Pin #12 IO00
* TX – Pin #16 TX
* RX – Pin #15 RX
*************************************************************************/
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// Blynk App authentication token, wifi ssid and password.
char auth[] = "***";
char ssid[] = "***";
char pass[] = "***";
// Esp8266 pins.
const int RED_PIN = 14;
const int GREEN_PIN = 5;
const int BLUE_PIN = 12;
void setup() {
pinMode( RED_PIN, OUTPUT );
pinMode( GREEN_PIN, OUTPUT );
pinMode( BLUE_PIN, OUTPUT );
Blynk.begin( auth, ssid, pass );
}
void loop() {
Blynk.run();
}
Example 4: blynk rgb led strip
red_esp= map(value_red_esp, 0, 673, 0, 255);
green_esp= map(value_green_esp, 0, 673, 0, 255);
blue_esp= map(value_blue_esp, 0, 673, 0, 255);
Example 5: blynk rgb led strip
if( red_esp >= 254){
red_esp = 255;
}
if( green_esp >= 254){
green_esp = 255;
}
if( blue_esp >= 254){
blue_esp = 255;
Example 6: blynk rgb led strip
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "********************************";
char ssid[] = "**********";
char pass[] = "*********";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}