Accessing the GPS shield from the Arduino IDE

The GPS shield provides the hardware interface to the GPS device. Now, you can access the GPS data from inside the Arduino IDE. To do this, perform the following steps:

  1. As with most devices, the first step is to download the appropriate libraries. For this device, you'll find the libraries at www.dexterindustries.com/manual/arduino-shields/gps-shield/ under the Arduino GPS Shield Drivers (zip) selection.
  2. Unzip the dGPS file and copy the dGPS file folder to your Arduino's libraries directory. You'll also need to download another three examples from this page. These aren't really set up to put in the Examples directory of dGPS and open automatically using the File | Examples process, but you can simply open them by navigating to File | Open command.
  3. Once you have the library installed, let's write a simple program that reads the values from the GPS device. Open the Arduino IDE and type in the following code:
    Accessing the GPS shield from the Arduino IDE
  4. Now, upload the preceding code to Arduino and then open Serial Monitor. You should see something like the following screenshot:
    Accessing the GPS shield from the Arduino IDE

These are the GPS readings from the device. As noted in the previous section, Status tells you whether or not your device is locked to enough satellites. In this case, V indicates that our device is not. You may need to go outside a building to connect with enough satellites to get a valid reading. A valid reading would look like the following screenshot:

Accessing the GPS shield from the Arduino IDE

The library for this device is quite extensive, and you can get back much more than your position. In fact, Example 2: Calculating GPS distance to destination, azimuth (angle of travel) to destination. (zip) that you can download from www.dexterindustries.com/manual/arduino-shields/gps-shield/ will show you how to use the library to enter a desired latitude and longitude value and return the distance as well as the angle of travel to the desired location.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.151.154