Sending Data to and from MIT app to Arduino via bluetooth (HC05)

Nevertheless Ryley

  1. You want to store the Arm movement start-to-finish, correct?
  2. The App sends the data to the board to make that happen, correct?
  1. Yes, I have the code and app blocks to do that without any issues. All the positions saved are stored in a list which is then stored in Tinydb (each save has 6 servo positions for reference).

  2. In terms of saving positions,the app sends a signal to the arduino, the arduino then sends the servo positions to the app, the app then stores those sent positions to a list.

The answers are simply yes or no - I take your answers as yes.

  1. You are storing the data so that it can be recalled and replayed?
  1. Yes
  1. The App, having recalled the data, sends it to the board to be replayed.
  1. No

That is what I want to do but I cannot get that to work properly

So 4 is a yes!

With respect to what I want the app to do then

  1. Yes

Exactly so.

That is why you need to store what the App sends, so it can re-send to the board and the board receives the data in the same way as it would if the data was input manually - now do you get it?

Okay, I understand what you mean in suggesting that, but, in order to do that I would need to re-do almost everything as currently, the app does not have any positional data until it's received from the Arduino due to how its coded.

In saying that, what I have for receiving the positions from the Arduino works well and I accurately get the data and store it into the app which puts me in the same position using both methods. I have the position data, but, the problem is now sending it to the board from here.

The actual problem is the board would need to have a huge amount of extra code to receive the data in a different format.

In an earlier post I sent you a link to an App on the gallery. You can study the code of that App.

Yes

their app looks good but I don't see anyway of being able to see their MIT app developer blocks to help me with the problems I am having.

Are you able to help me identify some of the problems in my MIT app inventor blocks? if not completely understandable, ill try something else, but, what you are suggesting in terms of redoing everything like the app sent above isn't an option due to time constraints.

I can't help you to fix what you have but I don't think it's less work to try to fix the current method than it is to replace it, in my opinion the method is flawed. I have my own time constraints and when I'm on the forum, others to help too - we are a small team serving a lot of people.

@Ryley
I have verified that the TinyDB correctly obtains the SAVE positions, for example (90 70 32 32 54 64 34 43 53 43 54 65 65 32 67 65 34 98), a list that is a multiple of 6 since they are saved 6 by 6 servos.

Send the data using a for loop, I don't think it's a good option with App Inventor, since AI2 has a particular way with events. A Clock would be better and send the data every so often.

delayeee

In the runSteps function I see many delays, in such a way that a servo must wait for another one to finish to start its movement, if during this time the application sends a data, the Bluetooth may not receive it.

I think it would be a good idea to do a simple debug, for example to have a TinyDB with a simple AllPositions = (40 50 60 70 80 90)
. Click a button and send those values ​​to make the servos move.
You can send the 6 values ​​at the same time and try to move the servos at the same time, this would be more complicated, since if you use "delay" one servo must wait for the other.
Or better to send one by one the position of each servo, when a servo ends it returns a position of "I_posicioned", and start the movement of the next servo.

To debug, simplify the runSteps code, eliminate the RUN, PAUSE, RESET.

Anyway another way to do it would be by angle, in a servo you can indicate the angle and the axis will move to that angle, it is not necessary to do an j++

Look at the first example, in the Serial Monitor I write 45 and the servo will move to the angle 45 of its axis.
http://kio4.com/arduino/28servo.htm

1 Like

here is an amazing article on Connect your Phone to Arduino through Bluetooth hc05 module a flexible aap and super easy code might help you guys

Hello Nena

With respect, we can connect to an HC05 blindfolded. The article you link to is more of an advertisement for an App (no Android code shared), probably does not use App Inventor and has nothing to do with robot arms and servos.

1 Like

2 posts were split to a new topic: Bluetooth, I do not see the list of devices