User avatar
By Truc
#68466 is it possible? ESP8266 connect to router wifi via iOS application?
I want to make an application control something by ESP8266. My workflow bellow:

- Open the app, on the device connected to wifi router.
- Connect to ESP8266 and give it SSID and PASSWORD info from current Wifi.
- ESP8266 receive this infos and auto connect to Wifi router.

Thank for your advices first.

I tried this way but I get user experience. Because user has to do many steps.
- Using WiFiManager, make ESP8266 as wifi router.
- Go to Wifi setting from device to connect to ESP8266 Wifi.
- Give Wifi infos (SSID, PASSWORD) by go to 192.168.4.1 from web browser.
Just note here to avoid this way :D
User avatar
By Truc
#68614
martinayotte wrote:Don't expect to much wizardry ...


Dear Martinayotte,

I know that it is possible, I have a demo (Board include ESP8266, an application). But I don't have any source code. Poor me.

Btw, thank for you response.
User avatar
By Truc
#68705 I found the way to do that:
This is code on iOS application:
https://github.com/EspressifApp/EsptouchForIOS

This is code on ESP8266 run on Arduino:
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

WiFiUDP Udp;

void setup() {
int cnt = 0;
//Allocate baud 115200
Serial.begin(115200);
//Set Mode wifi is station
WiFi.mode(WIFI_STA);
//Waiting for connect
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if(cnt++ >= 10){
WiFi.beginSmartConfig();
while(1){
delay(1000);
//Checking the connection success and print inform message
if(WiFi.smartConfigDone()){
Serial.println("SmartConfig Success");
break;
}
}
}
}

Serial.println("");
Serial.println("");

WiFi.printDiag(Serial);

//Allocate server
Udp.begin(49999);
Serial.println("Server started");

//Print IP address
Serial.println(WiFi.localIP());
}

void loop() {
//Receiving package from ESPTouch
Udp.parsePacket();
//Print IP of ESP8266
while(Udp.available()){
Serial.println(Udp.remoteIP());
Udp.flush();
delay(5);
}
}