I'm writing some code away from my arduino so throught I'd throw my code out there to see if I have it right seeing I can't debug it with the arduino itself. The code verify's OK but that doesn't mean it will work.
I've written something that does a "http get" request using the esp8266 (NodeMCU) I have running on its own and it worked well... but I am now trying to do another "http get" request, but this time using the arduino uno with a esp8266 on serial pins used for wifi.
I didn't fully understand the WIFIClient client line and the rest of the code in detail, however I got it working.
Now I am using the arduino uno (with esp8266 for wifi) do I now include "WiFi.h" instead of "ESP8266WiFi.h"?
I call the routine "doggycameratrigger()" thats shown below from inside my main loop when certain conditions are met.
It basically triggers my IP camera in blue iris using the web address
void doggycameratrigger() // sending the trigger to Blue Iris web-server for the "Doggy" camera
{
WiFiClient client;
if (client.connect(BIserver, 818)) { // (81) Port number of the Blue Iris web server //CHANGE THIS if you don't use port 81.
// Make a HTTP request:
client.print( "GET /admin?camera=");
client.print("Doggy");
client.print( "&trigger");
client.println( " HTTP/1.1");
client.print( "Host: " );
client.println(BIserver);
client.println( "Connection: close" );
client.println();
client.println();
client.stop();
}
}
The usual way of using the ESP8266 as a network peripheral device for say a Uno is to leave (or reflash) the original software on it and use AT commands over a serial connection.
Since the ESP outperforms the uno in all respects (apart from the number of available pins), why not simply run the new function on the ESP ?
6v6gt:
The usual way of using the ESP8266 as a network peripheral device for say a Uno is to leave (or reflash) the original software on it and use AT commands over a serial connection.
Since the ESP outperforms the uno in all respects (apart from the number of available pins), why not simply run the new function on the ESP ?
I hear you and agree but....
I started the process off with just the Uno, then realised I wanted to connect it to my wifi so bought the esp8266 esp-01. Then realised how good the esp8266 was, so my new projects that use digitial pins only now use a NodeMCU (esp8266) only.
But as this project is all hooked up (uno using the esp8266 through serial) and running well, I don't want to change the circuit as its working how it is. I am also looking at using the analog inputs on the uno, of which the esp8266 has only one that is limited in voltage range I believe..
So I would prefer to stick with the hardware I am using for this project only, and just work out how to get the http get request to work and work out what library I need to include for the "client" commands for the uno/esp8266 combo using hardware serial (pins 0 and 1)
What you are attempting is something which has been realised on the new Arduino Uno WiFi product which has a completely new architecture to support it.
You cannot simply invoke standard WiFi library methods on a Uno, which are intended to interact with devices physically connected to the Uno such as a wifi shield or an ethernet card, and hope that these will do something useful on a loosely connected ESP8266 device which is running the Arduino firmware.
I guess your best approach, if you have ruled out running everything on an ESP device, is to reflash the original nodemcu firmware on the ESP01 you have and use that with AT commands.
You might also be able to use I2C between the Uno and nodeMCU in such a way that your Uno runs the doggycameratrigger() function and tells the nodeMCU (via I2C) to, for example, issue an HTTP GET request dependent on the results it has received from the uno.