I recently purchased a Duinotech wifi shield from Jaycar (https://www.jaycar.com.au/arduino-compatible-esp-13-wifi-shield/p/XC4614) to test connecting to Wi-Fi on my Arduino UNO. I thought it would work out of the box (I was mistaken) and I have run into some big issues. It has taken me a day or so to figure out how it worked such as that is works via pins 0 and 1 for communication between the Arduino. I read up this post on how to connect this to my Arduino using the WiFiEsp Library. It successfully connects to my network using the examples and guide by Pert on the post. However, the Shield does not output any data to the Serial. When using this code which is supposed to retrieve as ASCII logo from arduino.cc and print it to the Serial, it does the DNS lookup fine but no actual HTTP GET request is made by the Shield using this library. Does anyone have a solution to this? Thank you.
/*
WiFiEsp example: WebClient
This sketch connects to google website using an ESP8266 module to
perform a simple web search.
For more details see: http://yaab-arduino.blogspot.com/p/wifiesp-example-client.html
*/
#include "WiFiEsp.h"
char ssid[] = "xxxxx"; // your network SSID (name)
char pass[] = "xxxxx"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
char server[] = "arduino.cc";
// Initialize the Ethernet client object
WiFiEspClient client;
void setup()
{
// initialize serial for debugging
Serial.begin(115200);
// initialize ESP module
WiFi.init(&Serial);
// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (true);
}
// attempt to connect to WiFi network
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);
}
// you're connected now, so print out the data
Serial.println("You're connected to the network");
printWifiStatus();
Serial.println();
Serial.println("Starting connection to server...");
// if you get a connection, report back via serial
if (client.connect(server, 80)) {
Serial.println("Connected to server");
// Make a HTTP request
client.println("GET /asciilogo.txt HTTP/1.1");
client.println("Host: arduino.cc");
client.println("Connection: close");
client.println();
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them
while (client.available()) {
char c = client.read();
Serial.write(c);
}
// if the server's disconnected, stop the client
if (!client.connected()) {
Serial.println();
Serial.println("Disconnecting from server...");
client.stop();
// do nothing forevermore
while (true);
}
}
void printWifiStatus()
{
// print the SSID of the network you're attached to
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength
long rssi = WiFi.RSSI();
Serial.print("Signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}