Speed signal from GPS

Can anyone please help me with the following:

I want to get a ground speed signal (km/hr, or Knots) from a GPS (connected to Arduino).

Im am using:

NMEA gps(GPRMC); // GPS data connection to GPRMC sentence type

And am looking for a speed signal with the following line:

if (speed>x) {do something;}

I have a LED on an output that goes high when this something is done, but nothing gets done.

I have tried moving the GPS much faster than x, and for more than a minute, but no response.

Any help appreciated.

Thanks.

Have you tried to print out the speed to make sure it is correct and changing?

Have you tried to print out a line when you think the LED should go on or off?

Without the code, it is difficult to see if you have a SW or HW error.

Could you be doing the conversion incorrectly? the speed field in the RMC sentence is given in knots, you’ll need to convert this if your comparison speed “x” is in some other units, such as km/h.

As fll-freak says the best way to debug is to output your speed over serial or something to make sure it is giving you what your think it is. I also hook up my PC as a “GPS simulator”, and send GPS sentences with known values to make sure the calculations done on the microcontroller are correct.