App not responding

yea Arduino gets connected. Infact it gets data at first but after sometimes this happens

1 Like

ok thanks I'll let you know after using it

What I saw in your app that could cause stopping receiving things, is that you did not check whether there were in fact bytes to recieve by using the bytes availabletoreceive block, and the usual way to do this properly, is to have clock and on the Clock.Timer event check if something is there and only then try to read it.
Now, with your -1 value in the receiveText block, AppInventor will wait until there is something, until it receives a \n character (are you sending one, actually), and choke while it is waiting.

1 Like

First of all thanks for your guiding but I'm sorry to tell that I don't know how to use it. I am trying to design my app for the first time and have no idea of many things. I am trying to understand so guide me in more detail.
Thanks for your support

Have you read post #9 and tested BTclient_test2.aia?
If so, then show your new blocks.

I have checked it and I think I'm unable to explain what the actual problem is.
Issue is I have a project to have location, speed and distance covered by a vehicle on the mobile app using different buttons. When I implement it sometimes it gives 100% desired results like shows location and speed and distance and just after few tries it says app is not responding wait or close it.
Then I entered input from Arduino IDE and to my surprise I got results displayed in the app. I'm confused with the thing that what is the error and how should I set it.
I hope now you got what I'm trying to do and help me through it.
Once again thank you for your support its so nice of you.

Are you testing with Companion or the APK?
And show all relevant blocks.

Here is a simple BlueTooth text receiver sample, for single value per line:
blocks
initialize global message to


1 Like

I'm testing with APK and these are updated blocks

thank you I'll inform you after implementing it

I've to send the text from the app using buttons and then receive data how to implement clock timer for button kindly guide me

You did not follow @ABG's advice by implementing a clock, and you did not test whether there were in fact bytes available to receive. You cannot assume that the bytes you want to recieve are available immediately, the Arduino needs some time to send them. Therefore you need the clock to check now and then to see if there are some available. And you have to sort out for which button press the reply was if there is data available. Good luck.

Until you do that, there is not much point in trying to help you.

The Clock is in the Sensors Drawer in the Designer.

Hi, you shared the sample code for receiving the data via bluetooth I've a confusion my scenario is I've buttons. How should I used clock with buttons kindly guide me with it

(Canned Reply ABG - Public Only)

I do not provide private support.
You will get more informed and quicker worldwide support by asking in a new public thread.

Making this thread public.

...

Dear @Mahzaib_Munawar,
the annexed files are the super-simple examples of a working communication on BT between AI2 and an Arduino NANO board fitted with a HC05 or HC06 BT shield.
They work fine (:slight_smile:) on my desk. My testing device is a Lenovo 10" pad featuring Android 10 and an Arduino Nano with a HC06 shield.
I hope you will get help from them.
Obviously it is not mandatory to have an Arduino NANO, it will work with any board (UNO, MEGA,..) with serial interface capability toward an HC0x BT shield (connection schematics below).
Please be aware that on app side it could be necessary to allow the appropriate permissions (scan/connect/geolocalization) as the newer Android versions require. Related to this last matter there are already many topics with examples and solutions by @ABG, @Anke and many others.
Best wishes for your project.

BT_to_Arduino.aia (26.3 KB)
BT_Monitor_Nano.ino (3.3 KB)

It has taken me a while to understand your self imposed limitation.

To combine features of different apps, think of them as a merger of two adjoining factories, keeping the machinery and the workers, and the flow of unfinished products from work station to work station.

In this case, the workers are the Event blocks for the Clock Timer and the Button.Click events.

I hope this analogy helps.

1 Like

Thank you so much it is working after some alterations as per my requirement

1 Like

Nice to read that !!! :hugs: :hugs: :hugs:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.