Clock not firing continuously

Hello App Inventor community. I am new to the world of App Inventor and was playing around with it when encountered an issue. I am not sure if this is a bug or I am doing something wrong but as I understand it, the clock feature - when TimerEnabled is ticked and when TimerAlwaysFire is ticked - then the clock should be occuring repeatedly according to the internal that is set. I have my Clock1 set to fire every 1000ms. However it does not appear to be firing repeatedly, it appears to be firing once.
Here is the program I am working with which is predominantly from a youtube video I saw:

As you can see the program is meant to check if there is a connection between the Bluetooth device and the app and indicate this connection status every time the clock fires (every 1000ms). It was not updating the connection status and when I added the following to the clock segment to see if the clock was firing:

Counter addition

Unless I am doing something wrong or misunderstanding how this works, this indicated that the clock was only firing once because the count only increments to 1 and no more. I came across this topic which suggests that my understanding of the clock feature is correct (it should be executing periodically according to the set interval) so I am inclined to believe that this could be a bug on my side? The version of App inventor that I am using is:
Built: September 2 2020 Version: nb185a
Use Companion: 2.60 or 2.60u
Target Android SDK: 29 (Android 10.0)

Could this be an issue because I am testing this program on a note 8 that is running android version 8.0.0?
Please advise.


Your counter was not counting.

1 Like

I think we should pay them a visit.
Where are they?


Where did you get the idea to check if a button is enabled before responding to its click event?

Do you have buttons that respond to clicks, even after they are disabled, like zombies coming back to life?

Should MIT be sending a response team in hazmat suits to deal with your zombie buttons?

Or instead, should you be checking if your BlueTooth is connected before trying to send data on it?

Woops :sweat_smile:, I see what I did wrong there. I have changed this to:

Counter addition fixed

The counter is now working perfectly indicating that the Clock is executing as it should.

Thank you @ABG

I found this program following this video here :neutral_face:

hahaha sorry I am very new to App Inventor so I did not even think to question this, just assumed it is the way to do things :sweat_smile:
Okay now that you mention this, it makes more sense that the button checks are altered as you suggested:

Button click check fixed

No response team needed, zombie buttons have been neutralized :grin:
Thanks @ABG for your advice and help thus far. I still have a problem, the Connection status being checked by the clock periodically does not appear to be updating when I disconnect my Bluetooth device (when I switch off the ESP32 controller) or when I move out of range: the app does not change the connection status to "Disconnected". Maybe the way that the "IsConnected" function works does not detect a break in the connection if the Bluetooth device is switched OFF or out of range?

This sounds like a familiar complaint.
Please check


1 Like

The second link looks like it will solve my problem. I will try it and provide feedback if I have any issues, Thanks a lot @ABG :slightly_smiling_face:

I have amended the program as the solution in link 2 suggested:

The error message "Error 516: Unable to write: Broken pipe" is popping up on the screen when I switch off my controller but Label1 still does not update to disconnected and I can't seem to see why not. What am I missing :confused:

supongo que si le dices que se desconecte si hay un error nunca llegara a estar conectado

your blocks do not help to find out, if the connection is broken, because the Connected property will not change to "false"... this is how the bluetooth communication once was designed...

if you get this message, then you know, that the connection is broken
you can catch that message in the Screen.ErrorOccurred event


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

Ola @Fran914293 Perdona mi español porque estoy usando el traductor de Google. Se conecta. el problema es que no detecta cuando se desconecta el dispositivo.

ah, claro, nunca trabaje con bluetooth entonces no se

Hello Taifun, thanks for replying to my issue. My next step was to investigate if I could use the error to detect a disconnection. In fact I came across something similar in a few google searches. I will try this method and update this post thereafter. Before doing so though, I am a little confused as to why the solution suggested by ABG in a previous comment (this one) worked for them but did not work for me. When you say:

do you mean that this solution worked previously but for AI2 it does not or did I do something wrong when incorporating that solution into my program?

This is critical ...BT_Disconnect

1 Like

no, it never worked for App Inventor nor for any other programming language because of the bluetooth design


@Taifun @ABG Thanks a lot for the assistance guys.
I am still pursuing the "catching the error" approach to prevent the standard ugly error message from popping up and rather use a customized notification instead.

see here App Inventor Tutorials and Examples: Bluetooth Chat | Pura Vida Apps
you might want to adjust it to your needs...

if errorNumber = 516
then do whatever you want


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like