PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Examples
Devices
Sensor
GPS
PAM-7Q GPS Test.c
1
/*
2
PAM-7Q GPS Test.c
3
4
Test PAM-7Q GPS module by detecting and displaying GPS fix status, latitude
5
and longitude measurements.
6
7
VDD -- 3.3V
8
TXD -> P11
9
RXD <- P10
10
GND -- GND
11
12
http://learn.parallax.com/propeller-c-simple-devices/
13
*/
14
15
#include "simpletools.h"
// Include libraries
16
#include "gps.h"
17
18
#define GPS_TXD 11 // GPS TX -> P11
19
#define GPS_RXD 10 // GPS RX <- P10
20
#define GPS_BAUD 9600 // Baud rate = 9600 bps
21
22
float
latitude, longitude;
// Latitude/longitude variables
23
int
fix;
// GPS fix indicator variable
24
25
int
main
()
// Main function
26
{
27
gps_open(GPS_TXD, GPS_RXD, GPS_BAUD);
// Open the GPS driver
28
29
while
(1)
// Main loop
30
{
31
latitude = gps_latitude();
// Get latitude
32
longitude = gps_longitude();
// Get longitude
33
fix = gps_fixValid();
// Check for valid fix
34
35
print(
"%c"
, HOME);
// Send cursor to top-left HOME
36
37
print(
"GPS Fix: "
);
// Display fix status
38
if
(fix)
39
print(
"Valid \n"
);
40
else
41
print(
"Not Valid \n"
);
42
43
print(
"\nLatitude Longitude\n"
);
// Display latitude/longitude
44
print(
"%f %f"
, latitude, longitude);
45
46
pause(500);
// Repeat in 1/2 second
47
}
48
}
49
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12