I'm trying to program an ESP8266 ESP-01 module to let it connect to my personal wifi network and activate a wireless relay that I've bought.
No problems with Wifi connection so I've omitted the code about it, my problem is to find what is the right PIN to set to LOW/HIGH to control my relay. Setting relayPin to 1 as shown in this code works and with it I can see the embedded LED turning on and off.
const int relayPin = 1;
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
Serial.println("Close Relay for 100 ms and then Open");
digitalWrite(relayPin, LOW);
delay(100);
digitalWrite(relayPin, HIGH);
delay(200);
}
Surfing the web I've found the following diagram about the ESP8266 ESP-01 module:
I've tried to set relayPin to 0 or to 2 but the relay doesn't activate/deactivate.
So, what is the right PIN number to set in my relayPin constant to control the GPIO0 port?
The relay works succesfully if I give him +3.3V on GPIO0 with an external power.
Thanks in advance