B4R Question Unable to send lot of data

lucdrb

Active Member
Licensed User
Longtime User
Hi,

I'll try to command a Servo with my phone, everything goes well but when it send (from phone to arduino) a lot of data (angle for the servo) I got this error:

Out of bounds error. Array length = 1, Index = 1

I've send the data directly or with B4Rserialisator to the arduino but always the same error when I slide the seekbar quickly.

the StackBufferSize and the MaxBufferSize = 1000

Any idea of how should I done to send the data and don't have any error?

Thanks
Luc
 

tigrot

Well-Known Member
Licensed User
Longtime User
I think you are filling up buffer more quickly than transmission itself can empty it. If this happens what you are looking for is not solved the right way. As Miker2069 writes you are trying send too much for the connection's capacity.
Good luck.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
where if data.Length = 1, then it passes the invalid message check, but... <downward whistling sound> boom!
Please note that poster is just following the sample code (in the text of the post, not the attachment) provided here: https://www.b4x.com/android/forum/t...d-and-receive-objects-instead-of-bytes.72404/

Out of bounds error. Array length = 10, Index = 65535
A clue may be this post: https://www.b4x.com/android/forum/t...es-to-array-out-of-bounds.102400/#post-642996. Nowhere in the code snippets provided above do we see a ser.Initialize. Looking at the sample B4R code provided in the posted link, no initialization of the ser object takes place. It is present in the B4A code though. Hm...
 
Upvote 0

lucdrb

Active Member
Licensed User
Longtime User
I'll control the flow of data with a timer and send it each timer_tick with an interval of 250.

Thanks for your advice

Luc.
 
Upvote 0
Top