How to send Latitude and longitude data to arduino Uno

Hello folks,

I am trying to send my phone GPS (Latitude and Longitude ) to Arduino uno. It is sending only 1 digit at a time, but i need entire latitude and longitude data to be send.

Thanks in advance.

Capture

You did not post your script (see Bluetooth HC-06. Arduino. Send. Receive. Send text file. Image for an example showing how to send text to an arduino using Bluetooth ). Are you using this example?

Hi SteveJG,

Thank you for your response, i would like to send mobile GPS data to arduino using location sensor, below is the script which i am using to read

void loop()
  if(Serial.available())
  {
    t = Serial.read();
    Serial.println(t);
  }

Thanks in advance.

How is variable t defined in your Arduino script?

From your problem description, it looks like your loop grabs input one character at a time,
and does a println() against each and every character.

The println() adds a \n New line character each time, so that would cause AI2 to show each character separately.

P.S. Look at the blocks that send your latitude and longitude as text.
You don't send any kind of delimiter characters (',' or \n) to tell the Arduino where one number ends and the other number starts, or even where one transmission ends and the next one starts.

Hello user,

Thank you so much for your response, i defined my variable as "char". Could you please tell me how can i define it ?

Thanks in advance.

(This observation might help you figure this out. I am guessing as I don't have any arduino experience)

char seems to be a single character; perhaps char should be string (which is another arduino data type) ? I also note you do not define a baud rate as other scripts used with Arduino show when data is passed to it through Bluetooth.

I'll have to leave that to more experienced Arduino coders.
Use the board's search icon (magnifier) and ask for FAQ Arduino for samples.

You might try this arduino script Hari:

=======================================

String a;

void setup() {

Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

}

void loop() {

while(Serial.available()) {

a= Serial.readString();// read the incoming data as string

Serial.println(a);

}

}

It is documented https://www.instructables.com/id/Arduino-Function-Serialread-And-SerialreadString/