Hello, I have an Esp 01 and Arduino mega.
My project is to install wifimanager on the esp01 with 8266 chip, connect it to the arduino mega through Serial3.
I put the code that I am using without success, I need help my level of programming is very low,
I have Esp 01 programmed with wifi manager and it works ok connects to wifi very well
If someone can help me I appreciate it, thanks
#define BLYNK_TEMPLATE_ID "xxxxxxxxxxxx"
#define BLYNK_TEMPLATE_NAME "test internet"
#define BLYNK_AUTH_TOKEN "xxxxxxx"
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <BlynkSimpleStream.h>
//int port = 80;
//char server[] = "blynk.cloud";
char auth[] = BLYNK_AUTH_TOKEN;
void setup()
{
// Debug console
Serial.begin(115200);
Serial3.begin(115200);
delay(10000);
// Blynk will work through Serial1
// Do not read or write this serial manually in your sketch
Blynk.begin(Serial3,auth);
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}```
#include <ESP8266WiFi.h>
#include <WiFiManager.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
void setup() {
// Inicializar el Serial
Serial.begin(115200);
// Inicializar el WiFiManager
WiFiManager wifiManager;
// Descomenta la siguiente línea para realizar un reseteo de la configuración WiFi
// wifiManager.resetSettings();
// Realizar la conexión WiFi y configuración automática si es necesario
if (!wifiManager.autoConnect("TuAP-ESP8266")) {
Serial.println("Error al conectarse y configurar WiFi");
delay(3000);
ESP.restart();
}
Serial.println("Conectado a WiFi");
// Inicializar OTA
ArduinoOTA.begin();
ArduinoOTA.setHostname("Mega+esp8266"); // Asignar un nombre de host para OTA
// ArduinoOTA.setPassword("tu_password"); // Establecer una contraseña para OTA (opcional)
// Opcional: configurar el nombre del dispositivo en mDNS
if (!MDNS.begin("esp8266")) {
Serial.println("Error al iniciar mDNS");
} else {
Serial.println("mDNS iniciado");
}
}
void loop() {
ArduinoOTA.handle(); // Manejar actualizaciones OTA
// Tu código adicional aquí
}```
Thank you Pete for your answer I already thought that it would not be possible. But I needed a professional to confirm it for me.
I have a code that works fine for me but I can’t integrate Wifimanager which was my purpose.
/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "xxxxxxxxxxxxxxxxx"
#define BLYNK_TEMPLATE_NAME "test internet"
#define BLYNK_AUTH_TOKEN "xxxxxxxxxxxxxxxxxxxxxxxx"
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#define ESP8266_BAUD 9600
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "TECNI-2G";
char pass[] = "123456789";
// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial3
// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
ESP8266 wifi(&EspSerial);
void setup()
{
// Debug console
Serial.begin(9600);
Serial3.begin(9600);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
´´´
You need to use a more modern device, such as NodeMCU or ESP32 if you want to use WiFiManager, but if you do that you’d be better using Blynk Edgent as this does the WiFi provisioning in a much nicer way than WiFiManager.
ok Pete but it is a sensor that works from 0 to 5 V depending on its value the votage could be 2.5 v, 1.5 v etc.
Would you make me a good conversion for your reader of the esp 8266 A0?