Blynk esp8266 esp12 standalone and rcswitch

new project , use ESP8266-12 connected to transmitter 433mhz to turn on and turn off the lights or other electrical equipment.

the transmitter is connected to 5v to increase the transmission distance

GPO13 - - - - ATAD ( transmitter 433mhz)

ESP8266-12
transmitter 433 mhz
3 wireless outlets remote control
power regulator 5v- 3,3v

rcswitch library



#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

//-------- rcswitch------
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxx";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, "ssid", "password");

 mySwitch.enableTransmit(13); // pin GPO13
 
}

void loop()
{
  Blynk.run();
}

//-------rcswitch------
BLYNK_WRITE(0) {  
 mySwitch.switchOn(1, 1);

  } 

BLYNK_WRITE(1) {
  mySwitch.switchOff(1, 1);
 
}

BLYNK_WRITE(2) {
 mySwitch.switchOn(1, 2);
 
}

BLYNK_WRITE(3) {
  mySwitch.switchOff(1, 2);

}

BLYNK_WRITE(4) {
 mySwitch.switchOn(1, 3);
 
}

BLYNK_WRITE(5)  {
  mySwitch.switchOff(1, 3);
 
}
4 Likes