Git Product home page Git Product logo

libgps's Introduction

GPS library

The GPS library

Build it

In order to obtain libgps.a

$ make
$ sudo make install

Use it

This project is mainly created for Raspberry ARM boards. After you have compiled the source code on the target or cross-compiling you can include it in your application

#include <gps.h>

The library mainly exposes few methods

  • gps_init - Initialize the communication
  • gps_on - Activate the GPS device
  • gps_location - Expose data from GPS (latitude, longitude, speed, course, altitude)
  • gps_off - Turn off the GPS device

This project abstracts all datas and replies in:

  • Decimal Degrees for latitudes and logitudes (46.235325, 7.12521)
    • Not degrees (42° 53' 23.25'' North - 4° 22' 46.3'' West)
  • Knots for speeds
  • Degrees for angles (course)
  • Meters for altitude

Example - Position logging

Create a simple position_logger.c file (you can find all in the examples folder)

#include <stdio.h>
#include <stdlib.h>
#include <gps.h>

int main(void) {
    // Open
    gps_init();

    loc_t data;

    while (1) {
        gps_location(&data);

        printf("%lf %lf\n", data.latitude, data.longitude);
    }

    return EXIT_SUCCESS;
}

Compile it

$ gcc -o position_logger position_logger.c -lgps -lm

Run it

$ ./position_logger

You will see your data directly in console:

45.071060 7.646363
45.071082 7.646385
45.071078 7.646387
45.071060 7.646373
45.071048 7.646358
45.071052 7.646372
45.071057 7.646392
45.071062 7.646397
45.071062 7.646383
45.071073 7.646395
45.071082 7.646403
45.071082 7.646403
45.071080 7.646395
45.071083 7.646392
45.071088 7.646393

You can rotate the output to files

$ ./position_logger >> position.log

That's all...

Tested components

This library is tested with:

  • Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates - Version 3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.