Sending Data to Arduino

Hi, I need some help with a small project which I am doing. I am trying to send longitude and latitude coodinates which are displayed in 2 seperate labels and assign them to existing variables in arduino.

I was thinking of using two buttons which send the longitude and latitude which will be stores into variables in arduino like I have shown in the following code, will this work. If so, how do I structure the blocks for the app?

Hello Taran

Just one Button is needed to send the values together. The code snippet you have posted would be more akin to sending the data from Arduino to the App.

Can we see how far you have got? Post your Blocks and the complete Sketch here.

  1. What Arduino model are you using?
  2. If the Arduino doesn't have Bluetooth built-in, what Bluetooth module are you using?

I haven't really made much progress, just in the early stages. I have the values which I want to send to the arduino via a bluetooth module (HC-05). On the Arduino side I don't have anything done since I am trying to understand how a value can be sent from the app to a particular variable.

This my current display and my blocks:


What I'm trying to do is use the "Send" button to assign the latitude and longitude values to pre-existing variables inside the code in Arduino, just to clarify my problem.

Here is an example Project that shows how to send two values 'joined' as one with a '|' separating them. The GUI is different to yours as I have quickly edited a template Project that others have used - study it carefully and copy the Blocks you need to the Backpack and then paste into your Project.

BT_Basic_Setup_Send_2Vals.aia (7.6 KB)

...and here is a simple example Arduino Sketch to receive the values:

ReceiveSerialData.ino (783 Bytes)

Note, I have assumed that the App 'SendText' sends an end of line (\n) character, if it doesn't, add one to the 'Join' Block that joins the two values.


Hi thats makes alot of sense, however since I am going to be sending alot of stuff to the arduino in different parts of the codes. How can I send data from the app to a particular variables, using something like comparing text. Are there any other ways?

How can I send data from the app to a particular variables.

My example does that - you can expand the number of vars:

                //Read Data From App
                lat = Serial.readStringUntil('|');
                lng = Serial.readStringUntil('|');
                dte = Serial.readStringUntil('|');
                hst = Serial.readStringUntil('\n'); 

Send codes to drive things like servo motors? You need to explain your Project's goal more fully for us to give the best advice.

You could also send short YAML messages


Hi, so my project is using a GPS module which sends waypoitn coordinates to a small robotic vehicle. I am using this app to set the waypoint then send the coordinates from the specific labels in the app to a specfic variable in the Arduino to communicate to the GPS and Compass modules.

Which why I was asking whther there is a way to send the coordinates to a specific variable in the Arduino code.

... in that scenario, you only send co-ordinates, so my first example fits the requirement.

However, that does not fit in with:

Thanks for the help. You're right the fight example you provided will work. I was just overthinking what I needed to do.

Thanks for the help.

Hi Chris, I am pleased to see how you help people. This time I would like some help, I already checked your contribution but I could not run it, for the fact that it is to send data to an Arduino board and I am trying to test your code on an ESP32 DEVKITC with a small change in the code to set the Bluetooth. Anyway I couldn't see the operation to see what things I could take to my project. Could you help me?

Juan, It doesn't matter what board you are sending to via Bluetooth. If you have a problem, it's probably one of two things:

  1. The data format sent does not match the format expected by the code for the board. Change one or the other to suit.

  2. Bluetooth is not working because it requires Google Security Permissions (find the answer on the forum, it's Android version dependent)