Select list item: List index too large Select list item: Attempt to get item number 2 of a list of length 1: () please help to this code as soon as possible please
Be sure to use println() at the end of each message to send from the sending device, to signal end of message.
Only use print() in the middle of a message.
Be sure not to println() in the middle of a message, or you will break it into two short messages and mess up the item count after you split the message in AI2.
Do not rely on timing for this, which is unreliable.
In the AI2 Designer, set the Delimiter attribute of the BlueTooth Client component to 10 to recognize the End of Line character.
Also, return data is not immediately available after sending a request,
you have to start a Clock Timer repeating and watch for its arrival in the Clock Timer event. The repeat rate of the Clock Timer should be faster than the transmission rate in the sending device, to not flood the AI2 buffers.
In your Clock Timer, you should check
Is the BlueTooth Client still Connected?
Is Bytes Available > 0?
IF Bytes Available > 0 THEN
set message var to BT.ReceiveText(-1)
This takes advantage of a special case in the ReceiveText block:
Receive text from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.
If you are sending multiple data values per message separated by | or comma, have your message split into a local or global variable for inspection before trying to select list items from it. Test if (length of list(split list result) >= expected list length) before doing any select list item operations, to avoid taking a long walk on a short pier. This bulletproofing is necessary in case your sending device sneaks in some commentary messages with the data values.
Here is an updated blocks sample illustrating these ideas ...
For good measure, also upload your .ino sketch.
It must match your app.
Thank you for helping as you have mentioned to change the global paired devices to item , i have changed that and in the AI2 Designer, set the Delimiter attribute of the BlueTooth Client component to 10, i alo have done that but still showing the problem.I have just copied the code from one of the youtuber who made the project so i don't even know about the other system that you have told me to change.
i can't understand that i had made this project previously and that was working properly but i have to do the same project for electrical ,but still now the app is not working when i am connecting to it with bluetooth.
(Canned Reply: ABG - Download those blocks and post them here)
Please download and post each of those event block(s)/procedures here ...
P.S. These blocks can be dragged directly into your Blocks Editor workspace.
I told you in two prior posts to use -1 for the byte count in the Bluetooth text read
Am I wasting my electronic breath?
BT_Control_4Load.aia (294.4 KB)
this is the aia file of our project please check this and resend it .
i am sending you our aia file can you check it and resend me after correction .please help .
BT_Control_4Load.aia (294.4 KB)
So you are a member of a team.
Get the other team member who wrote the .ino sketch to post it here, like I asked you 19 hours ago.
You implemented none of my recommendations.
Should I bother sending you more advice, or should I just correct it and send it directly to your instructor?
acutually i am doing it form you tube i am not in a team
its my fault i didn't know about the blocks system but still i am doing the project by the help of youtube .
please help me .please fix this and resend the corret aia file.