GPS 

Example

: Using Ephemeris

This example shows how to use the functions related with ephemeris.


File:
"WaspGPS_2_usingEphemeris.pde"


Code



/*
 *  ------Waspmote GPS Using Ephemeris Example--------
 *
 *  Explanation: This example shows how to use the functions related
 *  with ephemeris.
 *
 *  Copyright (C) 2009 Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Version:           0.1
 *  Design:            David Gascón
 *  Implementation:    Alberto Bielsa
 */

void setup(){
  
  //setup for Serial port
  USB.begin();
 
  // setup the GPS module
  USB.println("Setting up GPS...");
  
  // Inits SD pins
  SD.begin();
  
  // Power SD up
  SD.setMode(SD_ON);
  
  // Turn GPS on
  GPS.ON();
  
  // waiting for GPS is connected to satellites
  while( !GPS.check() ) delay(1000);
  
  USB.println("Connected");
 
}

void loop(){

  USB.println("Initializing SD");
  USB.println(SD.init());
  
  USB.print("Ephemeris saved ok(1), Ephemeris error(0): ");
  USB.println(GPS.saveEphems(),DEC);
  
  delay(5000);
  
  USB.print("Ephemeris loaded ok(1), Ephemeris error(0): ");
  USB.println(GPS.loadEphems(),DEC);
  
  SD.close();
  
}
    

Download code

You can download the code of this example.


© 2009 Libelium Comunicaciones Distribuidas S.L.

| Terms of use