1NMEA(3) User Contributed Perl Documentation NMEA(3)
2
3
4
6 GPS::NMEA - Perl interface to GPS equipment using the NMEA Protocol
7
9 use GPS::NMEA;
10 $gps = new GPS::NMEA( 'Port' => '/dev/ttyS0',
11 'Baud' => 9600,
12 );
13
15 GPS::NMEA allows the connection and use of of a GPS receiver in perl
16 scripts.
17
22 Get the position periodically:
23
24 #!/usr/bin/perl
25 use GPS::NMEA;
26
27 my $gps = GPS::NMEA->new(Port => '/dev/cuaa0', # or COM5: or /dev/ttyS0
28 Baud => 4800);
29 while(1) {
30 my($ns,$lat,$ew,$lon) = $gps->get_position;
31 print "($ns,$lat,$ew,$lon)\n";
32 }
33
34 Get the internal NMEA dump:
35
36 #!/usr/bin/perl
37 use GPS::NMEA;
38 use Data::Dumper;
39
40 my $gps = GPS::NMEA->new(Port => '/dev/cuaa0', # or COM5: or /dev/ttyS0
41 Baud => 4800);
42 while(1) {
43 $gps->parse;
44
45 # Dump internal NMEA data:
46 $gps->nmea_data_dump;
47
48 # Alternative to look at the internal NMEA data:
49 require Data::Dumper;
50 print Data::Dumper->new([$gps->{NMEADATA}],[])->Indent(1)->Useqq(1)->Dump;
51 }
52 __END__
53
55 Joao Pedro B Gonçalves , joaop@iscsp.utl.pt
56
58perl v5.8.8 2005-12-06 NMEA(3)