2017년 7월 15일 토요일

Send my phones GPS Lat and Long to my arduino.


I trying to build a project that uses my phones GPS lat and long, but I cannot find anywhere on the net to send the data to my arduino via Bluetooth. I've tried everything that I can think of but I can't seem to get the data to send to my arduino. I am able to connect my phone to the arduino via Bluetooth and send messages to the arduino but I don't know how to send the GPS. Attached is a pic of what I have so far, any help would HIGHLY be appreciated.



--
see this thread Received SMS>>Password control>>Localization>>Send position in SMS, which describes, how the location sensor works

-- 
Thank you for the post, however that thread doesn't answer my question.

-- 
you first might want to do some location sensor tutorials... see here: 
Map It: Displaying Locations on a Google Map
Exploring with LocationSensor in AI2

then you might want to try something based on this suggestion

it takes a few seconds until the location is available
make sure to enable GPS
then after a few seconds you should see gps in the AvailableProviders property
now set the ProviderName to gps and set ProviderLocked to truethis should give you the best result, assuming you are outside of a building and have a good gps signal...

then show us an updated screenshot of your blocks...

see also 

-- 
Thank you again for the post, however I read almost all the MIT app tutorials they have on GPS and Im still unable to find the answer that im looking for thus the reason to coming to this forum.

--
Adrian, what "answer that im looking for?"       Can you display the latitude and longitude on your device?    Are you developing using a device or an emulator.  The emulator will not provide latitude and longitude.

The following app requires a Button, two Labels and a LocationSensor (with the box in the Designer for Enabled un-checked.    Provided your settings on your phone are set to allow Location and GPS data, the app will turn on the LocationSensor with the button.  When the LocationSensor acquires a satellite fix, it will display the latitude and longitude in Label1 and will show how many seconds elapsed before getting a fix. The initial satellite fix always takes longer to acquire than subsequent fixes.  If you are in a building, this sometimes could take 20 or 30 seconds.

This app does not send the information to your BlueTooth.  You probably can do this by putting your Bluetooth.Client1SendText block with the puzzle piece global latitudelongitude  somewhere in the IF statement .  Remember, to send data using Bluetooth to an Arduino, both devices must be PAIRED.  Did you pair the devices?


This app is overly complicated because it is used to demonstrate why a developer cannot get an immediate response from the location changed event in the location sensor.  It will not let the latitudelongitude to appear until their is a satellite fix.  A developer can eliminate the IF block but sometimes what might be displayed if you use the LocationSensor.Latitude and LocationSensor.Longitude blocks is a pair of zeros (  0,0).  Those two block contain zeros until a fix has been made.

-- 
You say that you can read and write from your Arduino. You also attached some blocks in which you send the GPS longitude, but not the latitude, so that is only half of the coordinates. Did you actually receive something in your Arduino?
For debugging I would advise you to set a connected message, when you are connected to your Arduino and set the GPS coordinates in a label as you find them with your phone.

Can you also show your sketch that you use in your Arduino?

A basic question though is: What are you going to do with the GPS data in the Arduino? The amount of data will add up rather quickly and the storage in most Arduino's is very limited and not persistent.

--
At this time I can only send data to my Arduino, the blocks I posted do not send the data to my Arduino. I've tried every method I can think of and it will not send the data to my Arduino. In the blocks you'll see buttons and they send a text On and Off, those are just test to see of my bluetooth and my Arduino Talk. At this time they do I'm able to turn on and off an LED by clicking  one of the buttons. However I cannot seem to send the GPS Lat and Long. Also side note I created a simple location sensor to display the lat and long and for some reason they coordinates will not display, so I don't know if that is the issue.

-- 
If you want help, maybe post *all* your blocks, and/or an .aia. Post also your Arduino sketch, as far as it is relevant to receiving GPS information. The blocks you posted earlier could only send half of the GPS.

In your last post you say that you also do not see GPS information on your phone. It seems rather clear to me that you cannot send information that your phone does not have. Is GPS enabled on your phone? Is the locationChanged event ever triggered?

--

댓글 없음:

댓글 쓰기