Dexter Industries dGPS for NXT hack..

..was easy. I just got an UNO. This was my first Arduino project, aside from turning LEDs on. If anyone is interested, I'm happy to share the wiring.

//Dexter Industries DGPS Hack, reads UTC and that's it.....
#include <Wire.h>

int DGPS = 0x03; //3 is the address specified in the wiki

union{ //Create a union between a long and the four
byte readBytes[4]; //bytes due in from the dGPS unit
unsigned long value;
}UTC_buffer;

int i=0; //Misc initialization
int y=0;
unsigned long time=0;

void setup()
{

Serial.begin(9600);
Wire.begin();

}
void loop()
{

Wire.beginTransmission(DGPS);
Wire.write(0); // The "Get UTC" command
Wire.endTransmission();
delay(10); // take a deep breath......

Wire.requestFrom(DGPS, 4); // Request the 4 byte UTC
i = 0;
y=3;
if(Wire.available()==0) //Something went wrong if this code executes
{
Serial.println("Nothing there....");
}
else
{
while(Wire.available() && i < 4) //it's all good, grab some byte, meat!
{
UTC_buffer.readBytes[y] = byte(Wire.read()); //variable "y" reverses the byte order
i++;
y--;
}
}
time=UTC_buffer.value; //the Union at work......
Serial.print("UTC time is: ");

Serial.println(String(time));
Serial.println("=====================");
delay(5000);
}