P.S.
Here's some very rough test code I put together to make sure we were getting data from the GPS receiver. You might want to put this in an event handler-based class which parsed the data out and raised events whenever a new location was received.
But this will show you your GPS data stream I've put a 100ms delay in between each iteration of the loop so that we're not getting and printing one byte of data at a time.
I plugged TX, RX, and PWR into pins D0, D1, and D2. This corresponds to serial port 1 (COM1) and a "powerpin" of D2.
using System;using System.IO.Ports;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;namespace GpsLogger{ public class Program { public static void Main() { // write your code here SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One); serialPort.Open(); // pin D2 off = gps module turned on OutputPort powerPin = new OutputPort(Pins.GPIO_PIN_D2, false); while (true) { int bytesToRead = serialPort.BytesToRead; if (bytesToRead > 0) { // get the waiting data byte[] buffer = new byte[bytesToRead]; serialPort.Read(buffer, 0, buffer.Length); // print out our received data Debug.Print(new String(System.Text.Encoding.UTF8.GetChars(buffer))); } Thread.Sleep(100); // wait a bit so we get a few bytes at a time... } } }}
Hi Chris,
May i know what will be the output like?
There's no error but im just wondering how will the output like?
Sorry for my noob question. Im soooo new to this sensor device..