Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using Microsoft.SPOT;
- using Microsoft.SPOT.Presentation;
- using Microsoft.SPOT.Presentation.Controls;
- using Microsoft.SPOT.Presentation.Media;
- using Microsoft.SPOT.Touch;
- using Gadgeteer.Networking;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using Gadgeteer.Modules.GHIElectronics;
- using Gadgeteer.Modules.Seeed;
- namespace Gadgeteer_GPS_01
- {
- public partial class Program
- {
- GT.Timer timer = new GT.Timer(5000);
- bool gpsPositionHasBeenReceived = false;
- void ProgramStarted()
- {
- //gps = new GTM.Seeed.GPS(8);
- //gps.DebugPrintEnabled = true;
- gps.InvalidPositionReceived += new GTM.Seeed.GPS.InvalidPositionReceivedHandler(gps_InvalidPositionReceived);
- gps.PositionReceived += new GTM.Seeed.GPS.PositionReceivedHandler(gps_PositionReceived);
- gps.NMEASentenceReceived+=new GPS.NMEASentenceReceivedHandler(gps_NMEASentenceReceived);
- // timer robot
- timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
- timer.Start();
- button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
- // tell
- Debug.Print("Program Started");
- }
- void button_ButtonPressed(Button sender, Button.ButtonState state)
- {
- Debug.Print("GPS last position " + gps.LastPosition + " age " + gps.LastValidPositionAge);
- }
- void timer_Tick(GT.Timer timer)
- {
- Debug.Print("GPS last position " + gps.LastPosition + " age " + gps.LastValidPositionAge);
- }
- void gps_InvalidPositionReceived(GTM.Seeed.GPS sender)
- {
- Debug.Print("Invalid position");
- }
- void gps_PositionReceived(GTM.Seeed.GPS sender, GTM.Seeed.GPS.Position position)
- {
- gpsPositionHasBeenReceived = true;
- Debug.Print(position);
- }
- void gps_NMEASentenceReceived(GPS sender, string nmeaSentence)
- {
- if (!gpsPositionHasBeenReceived)
- {
- Debug.Print("NMEA Sentence: " + nmeaSentence);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement