Hello,
I am trying to create Soft AP with B4R. But unfortunately it is not working with B4R.
While I am trying the same code with Arduino IDE and it is working fine.
The below code I am running at Arduino and working fine....
B4X:
#include <ESP8266WiFi.h>
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.print("Setting soft-AP ... ");
boolean result = WiFi.softAP("ESPsoftAP_01", "12345678");
if(result == true)
{
Serial.println("Ready");
}
else
{
Serial.println("Failed!");
}
}
void loop() {
// put your main code here, to run repeatedly:
}
The below code is for B4R.... But not working
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Private result As Boolean
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
result=wifi.StartAccessPoint2("ESPsoftAP_01","12345678")
If result=True Then
Log("SoftAccess Ready")
Else
Log("SoftAccess Not started")
End If
End Sub
yes.... The result "SoftAccess Ready" is coming as expected.. But when I am checking the AP at my computer or at my mobile it is not showing the name ""ESPsoftAP_01". Whereas when I am running the same code from Arduino IDE it is showing the AP name at computer and also at my Mobile.
So your accesspoint is running but not visible.
If try to add code to make AP usefull , then it become visible.
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Private result As Boolean
Private server As WiFiServerSocket
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log(" ")
Log("AppStart")
result=wifi.StartAccessPoint2("ESPsoftAP_01","12345678")
If result=True Then
Log("SoftAccess Ready")
server.Initialize(62120,"server_NewConnection")
server.listen
Else
Log("SoftAccess Not started")
End If
End Sub
private Sub server_Error
Log("Error")
server.listen
End Sub
private Sub server_NewData (Buffer() As Byte)
Log("New data")
End Sub
private Sub server_NewConnection (NewSocket As WiFiSocket)
Log("New connection")
End Sub