Code for 'Smart Regulator' featured in 'Model Engineer', November 2020 on. Contains all work to August 2020 including all code described. Top level algorithm development is quite spares, leaving some work for you! Any questions - jon@jons-workshop.com

Dependencies:   mbed BufferedSerial Servo2 PCT2075 I2CEeprom FastPWM

Revision:
3:43cb067ecd00
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gps_mod.h	Mon Jul 27 08:44:59 2020 +0000
@@ -0,0 +1,58 @@
+#ifndef MBED_GPS_MOD_H
+#define MBED_GPS_MOD_H
+ 
+#include "mbed.h"
+const static double PI = 2.0 * acos(0.0),
+                    deg2rad = (PI / 180.0),
+                    km2miles = (39370.0/36.0/1760.0);
+class gps_mod
+{
+    enum    {NULLST, WAITING4DOLLAR, GOTDOLLAR, GOTHDR, WAITING4CR, WAITING4LF};
+    const   static  int MAXMSGLEN =  86;
+//    private: by default
+    bool    inmsg, newdata;
+    int ch, state, i, chcnt;
+    char hdracc[8], dest[6*(MAXMSGLEN + 4)],
+         posfix[4],
+         numofsats[4],
+         latstr[16],
+         longstr[16],
+         altistr[16],
+         speed_mphourstr[16],
+         headingstr[16],
+         datestr[16],
+         timestr[16];
+    char * destptr;
+public:
+//BufferedSoftSerial gps_module   (PinName _pinTx, PinName _pinRx);
+    gps_mod();
+    int update();
+    void   tock_handler();
+    char * position_fix_indicator  ();
+    char * message(int);
+    char * time ();
+    char * date ();
+    char * heading ();
+    char * mph ();
+    char * sat_count ();
+    char * latitude();
+    char * longitude();
+    char * altitude();
+    bool    fix_valid();
+    bool    new_data();
+    double mergedegmin (char *, char *);
+    double lat_merged ();
+    double lon_merged ();
+};
+ 
+//class Flasher {
+//public:
+//    Flasher(PinName pin);
+//    void flash(int n);
+//  
+//private:  
+//    DigitalOut _pin;
+//};
+ 
+#endif
+