Hi,
I am bulding a swing gate opener system and I would like the door to be controlled using Wi-Fi.
This is the topic where I talk about the system itself:Inductive Proximity Sensor - Project Guidance - Arduino Forum
I am very confused with the connections of the ESP8266-01 and the programming. I have an Arduino MEGA to program the Wi-Fi Module.
Basically my idea is to create an application or a web server with buttons for controlling the door.
I think I managed to connect the ESP8266-01 to the router but the Arduino showed this message or something similar
Leaving...
Hard resetting via RST pin...
This is the sketch I use and at the bottom is the error message.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(81);
const char* ssid = "Name"; //Enter Wi-Fi SSID
const char* password = "Password"; //Enter Wi-Fi Password
void setup() {
Serial.begin(115200); //Begin Serial at 115200 Baud
WiFi.begin(ssid, password); //Connect to the WiFi network
while (WiFi.status() != WL_CONNECTED) { //Wait for connection
delay(500);
Serial.println("Waiting to connect...");
}
Serial.print("IP address: ");
Serial.println(WiFi.localIP()); //Print the local IP
server.on("/", handle_index); //Handle Index page
server.begin(); //Start the server
Serial.println("Server listening");
}
void loop() {
server.handleClient(); //Handling of incoming client requests
}
void handle_index() {
//Print Hello at opening homepage
server.send(200, "text/plain", "Hello! This is an index page.");
}
Error Message
esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
File "C:\Users\SkyMaster\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/upload.py", line 25, in <module>
esptool.main(fakeargs)
File "C:/Users/SkyMaster/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool\esptool.py", line 2653, in main
esp.connect(args.before)
File "C:/Users/SkyMaster/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool\esptool.py", line 468, in connect
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
The sketch took more than a half of the memory of the Wi-Fi Module which is a bit weird for me, since my sketch for the swing gate opener system is quite a lot of code as well. I am not sure if the memory will be enough.
Is there a way to programm the Arduino MEGA and just use the Wi-Fi Module as a module to connect to the router instead of programming the Wi-Fi Module itself?

