B4R Question NodeMCU 1.0 (ESP-12E Module) - AccessPoint problem

Douglas Farias

Expert
Licensed User
Longtime User
Hello everybody.

I have a doubt.
I need to create an AccessPoint on the ESP8266.

I am using the following test code.

B4X:
Private Sub AppStart
    Serial1.Initialize(9600)
    Log("AppStart")
    
    
    If wifi.StartAccessPoint2("DOUGLASTESTE", "123456789") Then
        Log("WORKS")
        Log("Access Point IP: ", wifi.AccessPointIp)
    End If
   
Here is the log
[QUOTE]
End Sub
Hard resetting via RTS pin...
New upload port: COM3 (serial)
�$N|G�h�d�lCO���h`��KI:R�AppStart
WORKS
Access Point IP: 192.168.4.1
[/QUOTE]

The log suggests that everything is ok, but I don't see the WiFi network created on nearby devices.

When I try to search for the WiFi network, nothing appears.


I tried running similar code directly in the Arduino IDE and it worked.

see how the code turned out.
C++:
#include <ESP8266WiFi.h>

// Defina o nome e a senha da sua rede WiFi
const char *ssid = "NomeDaSuaRede";
const char *password = "SuaSenha";

void setup() {
  Serial.begin(9600);
 
  // Configurar o modo WiFi do ESP8266 como AP (Ponto de Acesso)
  WiFi.mode(WIFI_AP);
 
  // Configurar o SSID e a senha do WiFi
  WiFi.softAP(ssid, password);
 
  Serial.println("Ponto de Acesso Iniciado!");
  Serial.print("IP Address: ");
  Serial.println(WiFi.softAPIP());
}

void loop() {
  // Nada a fazer aqui, o AP está rodando
}


this code works ok.

I tried to do the same with c inline in b4r but it didn't work either.


B4X:
Sub Process_Globals
    Public Serial1 As Serial
    Private wifi As ESP8266WiFi
    Private ssid As String = "DOUGLASTESTE" 'ignore
    Private password As String = "123456789" 'ignore
End Sub

Private Sub AppStart
    Serial1.Initialize(9600)
    Log("AppStart")
    
    RunNative("SetAP", Null)
    RunNative("setSoftAP", Null)

    Log("Access Point IP: ", wifi.AccessPointIp)
    Log(wifi.LocalIp)
    
End Sub

#if C
void SetAP(B4R::Object* o) {
   WiFi.mode(WIFI_AP); // Configurar o modo WiFi para AP (Ponto de Acesso)
}
#end if


#if C
void setSoftAP(B4R::Object* o) {
   WiFi.softAP(b4r_main::_ssid->data, b4r_main::_password->data);
}
#end if


what could be wrong in b4r code?

I attached an image, which shows that the board and door are correct. They are the same on both the Arduino IDE and the B4R.

Note: I'm using the latest version of b4r, cli and java 14.0.1


thxx
 

Attachments

  • a1.jpg
    a1.jpg
    306.8 KB · Views: 142
Top