HI
How to send data from ESP8266 to APP when i config the ESP to
Soft Access Point
Which app do you want to send the ESP8266 data to? An android app that you’re going to create?
Or are you talking about building a web server to display sensor reading?
Thanks!
Hi Rui
The Android APP We create. But We want to send sensor reading from ESP8266 to Smartphone Directly without router.
If there is any code example we would be very happy
Thanks in advance for your help
If you want to use Wi-Fi, you need to set the ESP8266 as an access point. Then, you establish a Wi-Fi connection with your ESP8266. Your Android app can make HTTP requests to get data or publish data to your ESP8266.
However, with that setup in your Android phone, you need to be connected to the ESP8266 access point.
I don’t have any tutorial on that exact subject. But basically, you need to follow these two steps:
1. Set ESP as an Access Point (AP) (I have a tutorial for the ESP32: https://randomnerdtutorials.com/esp32-access-point-ap-web-server/ ) If you change that code:
// Load Wi-Fi library #include <WiFi.h>
To this:
// Load Wi-Fi library #include <ESP8266WiFi.h>
It should work for you.
2. Setup a ESP8266 web server that will receive/respond to HTTP commands
I personally don’t like use it as an Access Point, because you need to be disconnected from your main router/Internet connection and manually connect to the ESP8266 Access Point. I understand that in some scenarios that’s ideal…
Hi Rui
tanks for your answer i try to put the cod there same problem
that i can’t solve
WiFiClient = server.available();
Arduino: 1.8.7 (Windows 7), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200”
esp_8266_test7:42:14: error: expected unqualified-id before ‘=’ token
WiFiClient = server.available();
^
esp_8266_test7:43:8: error: ‘client’ was not declared in this scope
if (!client) {
^
esp_8266_test7:49:11: error: ‘client’ was not declared in this scope
while (!client.available()) {
^
esp_8266_test7:54:16: error: ‘client’ was not declared in this scope
String req = client.readStringUntil(‘\r’);
^
exit status 1
expected unqualified-id before ‘=’ token
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
I’m not sure what you uploaded, but if you modify the Sketch to look like this: https://gist.github.com/RuiSantosdotme/3de7c553657be162fd80c8d8d93452be
It will compile for the ESP8266 board. Can you try it?
Thanks!