list index too large app inventor

61 views
Skip to first unread message

AbiiSl

unread,
Apr 25, 2019, 2:19:55 AM4/25/19
to MIT App Inventor Forum
Hi there I'm trying to use 3 ultrasonic sensors and  a PIR sensor  so that's 4 sensors now Im struggling with the app, does anyone know whats wrong with the code?
Screen Shot 2019-04-25 at 1.13.35 AM.png
58676642_877866579255636_1190905014256664576_n.png

Chris Ward

unread,
Apr 25, 2019, 6:12:44 AM4/25/19
to MIT App Inventor Forum
Hello AbiiSI

We need to see the script/sketch of the microcontroller (e.g. Arduino)

TimAI2

unread,
Apr 25, 2019, 6:13:17 AM4/25/19
to MIT App Inventor Forum
You probably need to first test the response back from bluetooth - it may not be what you expect it to be, e.g. A|B|  instead of A|B|C|D

Chris Ward

unread,
Apr 25, 2019, 6:47:51 AM4/25/19
to MIT App Inventor Forum
Hi again AbiiSI

Is that screenshot of your Blocks all of your Blocks? - looks like some code is missing. If not, please capture them again and this time use App Inventor's built-in capture feature so that we get a top quality image that we can view & zoom:

https://www.professorcad.co.uk/appinventortips#TipsBlocks  How to create an image of your Blocks and add it to your Forum Post.

Currently,  it looks like Clock 1 is running before the process is ready! Note that The App Inventor Process must be set to be faster than the microcontroller sends the data. For example, microcontroller sends every 2 seconds, App Inventor Process (Clock Timer) cycles every 1 second.

ABG

unread,
Apr 25, 2019, 11:15:36 AM4/25/19
to MIT App Inventor Forum
Your messages are being broken up by the Clock Timer on their way in.
Solution: Use a message delimiter ...

Use println() to separate messages when you transmit.
Set Delimiter = 10 in BlueTooth Designer.
Check for Bytes Available > 0 in blocks,
but then request -1 bytes to get only full  messages.

ABG
Reply all
Reply to author
Forward
0 new messages