ESP EasyRelay little mod

8 years 6 months ago #2368 by javier
Replied by javier on topic ESP EasyRelay little mod
hahaha thanks for all i will write the sketch and try.

I don't have to tell to arduino how are the light, because arduino its the only one that control the lighs I only have one relay.
Attachments:

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2369 by javier
Replied by javier on topic ESP EasyRelay little mod
Sorry for the picture it seems that it´s draw by a 5 years old, trackpad its a sheet

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2393 by javier
Replied by javier on topic ESP EasyRelay little mod
THANKS FOR ALL :cheer: IT WORKS PERFECTLY! IT CHANGE THE STATE AT SERVER!

Here is my code for everyone who needs! it include 1 relay and one switch at pin 2, with arduino pull up resistor! only have to put gnd with pin 2 and the relay will change. Relay its at pin 6.

void loop()
{

esp.process();

estadoActual = digitalRead(pin);

if (estadoAnterior != estadoActual) // ha habido un cambio de estado

{
contador++; // cuenta los cambios de estado
int validarPar = contador % 2; // solo queremos los cambios pares
if (validarPar != 1) // si el cambio es par

{

digitalWrite(RELAY_1,!digitalRead(RELAY_1));
Esp8266EasyIoTMsg msgRelay1(1, V_DIGITAL_VALUE);
esp.send(msgRelay1.set(!digitalRead(RELAY_1)));

}

estadoAnterior = estadoActual;
}

}

void incomingMessage(const Esp8266EasyIoTMsg &message) {
// We only expect one type of message from controller. But we better check anyway.

Serial.println("New message");
if (message.type==V_DIGITAL_VALUE) {
// Change relay state

digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);

}
}

Please Log in or Create an account to join the conversation.

8 years 6 months ago - 8 years 6 months ago #2394 by javier
Replied by javier on topic ESP EasyRelay little mod
Thats the pcb

Please Log in or Create an account to join the conversation.

6 years 7 months ago #3868 by c150186.learn
hi,

How do you setup in the EasyIOT Server that connects to one ESP with one arduino but multiple relays? Is it possible?
If yes, please help me through this.
I was able to add the one ESP8266 driver to my server but I'm not sure how do I add other relays(pins) that is connected to that one ESP.

Thanks.. hope you can help

Please Log in or Create an account to join the conversation.

Time to create page: 0.242 seconds

Forum latest

  • No posts to display.