Posts: 3
Threads: 1
Joined: Dec 2019
Reputation:
0
12-31-2019, 09:45 PM
I've put together some really simple code on a Teensy 3.2 and connected via an HC-06 to the touchDRO app. First time it connected and worked OK for a few minutes. Then it kept dropping the BT connection. It would reconnect and then drop again straight away. I've tried it on two phones, same happens. Tried a different HC-06, same issue. It will connect to a serial port terminal on the phone and hold the connection.
Any ideas what I'm doing wrong?
My code just outputs via Serial1.print withe the ; delimiter I'm not using CR or new line, should I?
Posts: 328
Threads: 2
Joined: May 2016
Reputation:
10
What exactly are you printing? It looks like the app is not getting data in a correct format and drops the connection.
Posts: 3
Threads: 1
Joined: Dec 2019
Reputation:
0
01-01-2020, 09:39 AM
(This post was last modified: 01-01-2020, 10:27 AM by Markyd.)
This is the output
X666;Y0;Z0;X665;Y0;Z0;X664;Y0;Z0;X663;Y0;Z0;
or this if it goes negative
X-866;Y0;Z0;X-865;Y0;Z0;X-864;Y0;Z0;
I'm forcing Y and Z to 0 as I've only mocked this up with a single scale at the moment.
Could it be that I'm sending updates too quickly? I notice RysiuM's Arduino code contains some sort of trigger (tickTimerFlag), I just send the entire XYZ data string every time I receive a changed value.
Posts: 3
Threads: 1
Joined: Dec 2019
Reputation:
0
I think I may have solved my problem, it looks like the connection drops off if no data is sent for approx 30 seconds. Once it drops it won't reconnect and stay reconnected. I have to shut the app down and restart it. I've now changed the code on my Teensy (fast and cheap micro controller) to send an update every second even if the scale hasn't moved. This seems to have fixed the issue.