B4R Question Out of bounds error

AndroidMadhu

Active Member
Licensed User
Hello,
I am sending the data from Arduino to Esp8266.
I am able to send data from Arduino to ESP successfully as per the suggestion from @Erel, which is saved my time & Life :)

But after 1 minute of running I am facing error as "Out of bounds error. Array length = 2, Index = 65535"
Here is the error
B4X:
Wifi Connected Successfully!!!
Humid from Ardiono :33.39
Temp from Arduino :77.99
Humid from Ardiono :33.39
Temp from Arduino :77.99
Humid from Ardiono :33.39
Temp from Arduino :77.99
Humid from Ardiono :33.39
Temp from Arduino :77.99
Humid from Ardiono :33.39
Temp from Arduino :77.99
Humid from Ardiono :33.39
Temp from Arduino :77.99
Out of bounds error. Array length = 2, Index = 65535

Code at Arduino Side:
B4X:
Public Serial1 As Serial
    Public softserial As SoftwareSerial
    Public Timer1 As Timer
    Public Astrem As AsyncStreams
    Public bc As ByteConverter
    'Private humid(),temp() As Byte
    Private ser As B4RSerializator
Private Sub Timer1_Tick
    Dim humid(),temp() As Byte
    humid="33.39"
    temp="77.99"
    Astrem.Write(ser.ConvertArrayToBytes(Array(humid,temp))) 
    Log("Send to Esp8266 Successfully!!")
End Sub

Code at ESP Side:
B4X:
Public Serial1 As Serial
    Public softser As SoftwareSerial
    Public bc As ByteConverter
    Public wifi As ESP8266WiFi
    'Private timer1 As Timer
    Public Astream As AsyncStreams
    Private ser As B4RSerializator
    Private BE(2) As Object
Private Sub Arduino_Received_Data(buffer() As Byte)
ser.ConvertBytesToArray(buffer,BE)
Log("Humid from Ardiono :",BE(0))
Log("Temp from Arduino :",BE(1))
End Sub
 

AndroidMadhu

Active Member
Licensed User
Also what I found is the below code at ESP8266 side, where I am getting Out of Bound error
B4X:
Private BE(200) As Object
ser.ConvertBytesToArray(buffer,BE)
GlobalStore.Put(0,BE(0))    'humid.
GlobalStore.Put(1,BE(1))    'Temperature
Log("Humid :",GlobalStore.Slot0)
Log("Temparature :",GlobalStore.Slot1)

Even If I simply send data from Arduino without B4RSerializer, the above code is throwing error.

Please suggest...
 
Upvote 0

AndroidMadhu

Active Member
Licensed User
#StackBufferSize: 2000
I have increased this to 2000 at ESP8266.
Below I am getting error:
B4X:
Panic C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266\core_esp8266_main.cpp:103 __yield

ESP8266 restarting After 2 -3 minutes....
 
Upvote 0
Top