B4R Question I get error with ESP8266 ..Can help ???

naifnas

Active Member
Licensed User
with ESP8266 ESP-01S ESP01S Serial Wireless WIFI Module
and UNO R3
and Arduino 1.8.12
and i already dd the following URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json
i use example this
i attach image all

B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 600
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Public WiFi As ESP8266WiFi
    Public esp As ESP8266
    Private eeprom As EEPROM
    Private const MAGIC_EEPROM As Byte = 123
    Private bc As ByteConverter
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    WiFiServer.Start
    ConnectToNetwork
End Sub

Public Sub SaveNetworkDetails(SSID As String, Password As String)
    Log("Saving network data: ", SSID, ", ", Password)
    SSID = bc.StringFromBytes(WiFiServer.ReplaceString(SSID, "%20", " "))
    eeprom.WriteBytes(Array As Byte(MAGIC_EEPROM, SSID.Length + 1 + Password.Length), 0)
    Dim pos As Int = 2
    eeprom.WriteBytes(SSID, pos)
    pos = pos + SSID.Length
    eeprom.WriteBytes(Array As Byte(0), pos)
    pos = pos + 1
    eeprom.WriteBytes(Password, pos)
End Sub

Public Sub ConnectToNetwork
    WiFi.Disconnect
    'read settings from EEPROM
    Dim header() As Byte = eeprom.ReadBytes(0, 2)
    If header(0) = MAGIC_EEPROM Then
        Dim data() As Byte = eeprom.ReadBytes(2, header(1))
        Dim i As Int = bc.IndexOf(data, Array As Byte(0))
        If i = -1 Then
            Log("Error parsing network data.")
            Return
        End If
        Dim SSID As String = bc.StringFromBytes(bc.SubString2(data, 0, i))
        Dim Password As String = bc.StringFromBytes(bc.SubString(data, i + 1))
        Log("Trying to connect to: ", SSID, " password: ", Password)
        If WiFi.Connect2(SSID, Password) Then
            Log("Connected successfully to: ", SSID)
            Log(WiFi.LocalIp)
        Else
            Log("Failed to connect.")
        End If
    Else
        Log("Network data not found.")
    End If
End Sub
i chosse in Board selector - Arduino UNO
i get this error
B4X:
.................
.................
[cc.arduino.packages.discoverers.serial.SerialDiscovery] Fail to get the Vid Pid information from the builder response code=404
In file included from C:\Users\ENTER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:28:0,
                 from C:\Users\ENTER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,
                 from D:\d\B4R\exmple\wifi\1\ESP826~2\ESPCON~1\Objects\bin\sketch\rESP8266WiFi.h:7,
                 from D:\d\B4R\exmple\wifi\1\ESP826~2\ESPCON~1\Objects\bin\sketch\B4RDefines.h:26,
                 from D:\d\B4R\exmple\wifi\1\ESP826~2\ESPCON~1\Objects\src\src.ino:1:
C:\Users\ENTER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:27:10: fatal error: functional: No such file or directory
#include <functional>
          ^~~~~~~~~~~~
compilation terminated.
exit status 1
DEBUG StatusLogg....................
..........................................

i chosse in Board selector - Generic ESP8266 Module
i get error
please help
i try this .. work

C++:
#include <SoftwareSerial.h>
SoftwareSerial ESPserial(7, 6); // RX | TX
int cnt=110;
void setup() {
  Serial.begin(9600);
  ESPserial.begin(115200);
  Serial.println("");
  Serial.println("");
}

void loop() {


  if (ESPserial.available()) {
    Serial.write( ESPserial.read() );
  }
  if (Serial.available()) {
    ESPserial.write(Serial.read());
  }

}
 

Attachments

  • 1.png
    1.png
    92.7 KB · Views: 205
  • 2.png
    2.png
    382.6 KB · Views: 197
Last edited:

janderkan

Well-Known Member
Licensed User
Longtime User
The support in Arduino and B4R is for this ESP8266 module. see pic
Your module is a ESP-01S , that is not the same.
You must use a serial protocol to communicate with the ESP-01S.

If you use the ESP8266 you dont need an Uno.
 

Attachments

  • HTB1aDlwPXXXXXbfXVXXq6xXFXXXH.jpg
    HTB1aDlwPXXXXXbfXVXXq6xXFXXXH.jpg
    69.4 KB · Views: 200
Upvote 0

naifnas

Active Member
Licensed User
The support in Arduino and B4R is for this ESP8266 module. see pic
Your module is a ESP-01S , that is not the same.
You must use a serial protocol to communicate with the ESP-01S.

If you use the ESP8266 you dont need an Uno.
Thank you
Yes i still use SoftwareSerial for connect..
So i try use library ESP8266WiFi but if not support now i cancel try .. thanks again
 
Upvote 0
Top