Hi - first of all, sorry Gunner and Pete for the mistake in my first post with the code
the Sketch works fine now but I´m working on a new project and need help as an absolute beginner.
First of all - what I´m gonna doing?
Controlling 2 wall sockets with a 2-way relay, nodeMCU, Blynk App and WS2812 led as indicator.
For now I can control the two relays and the leds via the blynk app. So if I push the button 1 - relay 1 is on and the led turns from red to green. Same with relay 2.
But now I want to add a simple touch sensor (TTP223) to controll relay1 / led 1 and relay2 / led 2 and update the state to blynk app.
If read the example of sync physical buttons with blynk, but as absolute Noob all looks like chinese chars
If tried to implement codes from this example but nothing works - could everyone help please?
#define BLYNK_PRINT Serial
#define PIN 13
#define relay1 14
#define relay2 12
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
char auth[] = "xxxx";
char ssid[] = "xxx";
char pass[] = "xxx";
char server[] ="xxx";
void setup()
{
strip.begin();
strip.show();
strip.setBrightness(64);
Serial.begin(9600);
pinMode(14, OUTPUT);
pinMode(12, OUTPUT);
Blynk.begin(auth, ssid, pass, server);
}
BLYNK_WRITE(V6)
{
int relayOne = param.asInt();
if(relayOne == 1)
{
digitalWrite(relay1, LOW);
strip.setPixelColor(0, 0, 127, 0);
strip.show();
}
else
{
digitalWrite(relay1, HIGH);
strip.setPixelColor(0, 127, 0, 0);
strip.show();
}
Serial.print("Steckdose 1 ist: ");
Serial.println(relayOne);
}
BLYNK_WRITE(V5)
{
int relayTwo = param.asInt();
if(relayTwo == 1)
{
digitalWrite(relay2, LOW);
strip.setPixelColor(11, 0, 127, 0);
strip.show();
}
else
{
digitalWrite(relay2, HIGH);
strip.setPixelColor(11, 127, 0, 0);
strip.show();
}
Serial.print("Steckdose 2 ist: ");
Serial.println(relayTwo);
}
void loop()
{
Blynk.run();
}