Help with bluetooth and accelerometer

347 views
Skip to first unread message

Victor Guizien

unread,
Dec 1, 2015, 3:57:54 PM12/1/15
to MIT App Inventor Forum
Hi, I made an app con control a car via bluetooth with the accelerometer,
.

My problem resides when I try to connect to the bluetooth modules (HC-06) the app crashes.
The screen displays the acceleration for the 3 axis and a coded message that is sent to the bluetooth and then interpreted via software (the message is such as: s500m300, s for servo and m for motor).

I tried disabling the labels that displayed the information and it worked, but I don't understand why it crashes ONLY after connected to the bluetooth module (and connection is succesful).

If the module isn't connected the axis refresh normally and I can see the accelerations changing in real time and the message being updated.

Thanks in advance.

Screenshots of the app code: 

Taifun

unread,
Dec 1, 2015, 5:57:55 PM12/1/15
to MIT App Inventor Forum
probably the accelerometer sensor changed event fires too often and your bluetooth component tries to send too frequently?
use a clock component and the clock.timer event instead, try different timer intervalls, for example 500 milliseconds ...
Taifun
PS: next time please add screenshot directly into your thread, see screenshot below

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         



Victor Guizien

unread,
Dec 1, 2015, 5:59:46 PM12/1/15
to MIT App Inventor Forum
Perfect ! That might be the issue, I'll look into the timer tonight, thank you for your help, I'll keep you posted since tomorrow I'll test it again. Thanks !

Victor Guizien

unread,
Dec 2, 2015, 3:28:02 AM12/2/15
to MIT App Inventor Forum
Hi! So I changed the code and it seems to be working now, thanks a lot.

But I get this permanent error message saying "Error 516: unable to write: Broken pipe".

What is causing this and how can I fix it ?

Thanks.

Taifun

unread,
Dec 2, 2015, 7:45:39 AM12/2/15
to MIT App Inventor Forum
first you need a connection, then you can send
if you get error 516, then there is no conection anymore

how to connect correctly


Taifun
Reply all
Reply to author
Forward
0 new messages