here's the code of my esp file - Pastebin.com now, I create an application using MIT App Inventor and i'm getting this error "error 1101 unable to get a response with the specified url" I assume that there's something wrong with my wiring or code.
Nice +1 for showing the wiring. -100 for not posting the code in code tags, when the code could be part of the problem.
Let me ask you how are the signals, as shown on the breadboard, going to jump across the grove in the breadboard? You've not made an electrical connection to the relays or the uController.
Most likely there's no connection from either harness to the controller.
There's no connection pass the little ditch.
Use a multimeter and check the resistans!
If you look at your breadboard, there are letters and numbers. The letters are a..e, a divider and f..j.
The electrical connection are e.g. a1, b1, c1, d1 and e1 (as one group) and f1, g1, h1, i1 and j1 (as another group); there is no connection between a..e and f..j.
You have to move your wires closer to the ESP8266 module (at the other side of the divider).
And this is how you should have posted code
#include <ESP8266WiFi.h>
WiFiClient client;
WiFiServer server(80);
const char* ssid = "xx"; //WIFI SSID
const char* password = "xx"; //WIFI PASSWORD
String data ="";
int Relay1 = 12; //D6
int Relay2 = 16; //D0
int Relay3 = 4; //D2
int Relay4 = 5; //D1
void setup()
{
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Relay3, OUTPUT);
pinMode(Relay4, OUTPUT);
digitalWrite(Relay1,LOW);
digitalWrite(Relay2,LOW);
digitalWrite(Relay3,LOW);
digitalWrite(Relay4,LOW);
Serial.begin(115200);
connectWiFi();
server.begin();
}
void loop()
{
client = server.available();
if (!client) return;
data = checkClient ();
Serial.print(data);
if (data == "Relay1ON")
{
digitalWrite(Relay1,HIGH);
}
else if (data == "Relay1OFF")
{
digitalWrite(Relay1,LOW);
}
else if (data == "Relay2ON")
{
digitalWrite(Relay2,HIGH);
}
else if (data == "Relay2OFF")
{
digitalWrite(Relay2,LOW);
}
else if (data == "Relay3ON")
{
digitalWrite(Relay3,HIGH);
}
else if (data == "Relay3OFF")
{
digitalWrite(Relay3,LOW);
}
else if (data == "Relay4ON")
{
digitalWrite(Relay4,HIGH);
}
else if (data == "Relay4OFF")
{
digitalWrite(Relay4,LOW);
}
}
void connectWiFi()
{
Serial.println("Connecting to WIFI");
WiFi.begin(ssid, password);
while ((!(WiFi.status() == WL_CONNECTED)))
{
delay(300);
Serial.print("..");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("NodeMCU Local IP is : ");
Serial.print((WiFi.localIP()));
}
String checkClient (void)
{
while(!client.available()) delay(1);
String request = client.readStringUntil('\r');
request.remove(0, 5);
request.remove(request.length()-9,9);
return request;
}
this is where i get confused about since as you can see in the image 1 since it is pinned in a and j that's why as you noticed I pinned the wiring a and j in image2. What do you mean at the other side of the divider? sorry im new and still learning.
and mybad for my code i didn't know there a command for it.
move the white and the purple to f22/f23 (under the ESP8266 module); move the control wires for the relais to the c, d or e row (above the ESP8266, same columns as you use now).
===
If you click the </> button, you will see below in the edit window
` ```
type or paste code here
``` `
replace type or paste code here by your code.
this works thanks!! however my relays works reverse like when I click "ON" it will "OFF" vice versa in the mobile application that I created if the relays has red light it indicates that is on right? oh well maybe I'll just reverse it for the meantime
It is normal for relay modules to be controlled such that a LOW input turns them on so either invert the inputs or use the NC contacts on the relays to switch the load