Hello everyone!!
Im working on a code for esp8266.
All ok but i have this one "small" problem that i cant find what i am doing wrong or what i forget!
so here is the code and i ll explain you !:
WiFiClient client = server.available(); if (!client)
{return;}
// Wait until the client sends some data
Serial.println(" Client Connected ");
client.println("Connection Established");
Here when the "client" connect we get the prinln "Connection Established"
but when i send the command and going to void i want also to println to client! heres the code of the void!:
void Device1 (){
digitalWrite(relaypin1, HIGH);
Serial.println (" Relay 1 is ON ");
client.println("Relay 1 is ON");
delay (delayTime);
digitalWrite(relaypin1, LOW);
Serial.println (" Relay 1 is OFF ");
pp1 = 1;
return ;
}
esp8266 execute the digital writes prints to Serial but client never get the println!!
Can anyone help me? any ideas what i must change/add?
A small point and not related to your problem, but it helps if you use the correct terminology and stops it looking like you don't know what you are talking about.
You do not have any voids. What you have is a function that does not return a value to the calling program and is therefore declared void. If it returned an int to the calling program its declaration would start like this
UKHeliBob:
A small point and not related to your problem, but it helps if you use the correct terminology and stops it looking like you don't know what you are talking about.
You do not have any voids. What you have is a function that does not return a value to the calling program and is therefore declared void. If it returned an int to the calling program its declaration would start like this
int Device1 ()
I hope that you would not then call it an int
Sorry for my bad english as far as i can see or for this small type mistake i made! i Just tell "Void" cause starts with it! Anyway thanks for both answers you gave me! and about the code i change it from "Void" to "int" and still client doesnt take the println.!! Maybe i must insert inside that int something like
client.connected() or if (client.connected) or something similar? i mean why it reads the client.println and doesnt print anything? anyway thanks for any help you provide so far again!