Query about ESP-01s with relay

I got an ESP-01S board with an ESP01S relay module.
In arduino IDE, I uploaded the following code to the board:
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

// Your WiFi credentials.
// Set password to "" for open networks.
const char ssid[] = "xxxxx";
const char pass[] = "xxxxxx";
int relay = 1;

ThingerESP8266 thing("xxxxx", "xxxx", "xxxx");

void setup()
{
  // Debug console
  Serial.begin(115200);

  thing.add_wifi(ssid, pass);

  pinMode(relay, OUTPUT);
  thing["RELAY"] << digitalPin(relay);

}

void loop()
{
  thing.handle();
}

Now when I plugin the board to the relay board, it boots up fine and I can see the ESP-01s showing up in my dashboard as connected.


However, nothing is happening when I toggle the relay switch. Even the LED on the relay board doesn’t light up. Any idea what am I missing?

Alright… I got the solution.
Just changed the pin number to 0
int relay = 0;
and the relay is working fine. :slight_smile:

(This thread can be closed)

1 Like