Shop OBEX P1 Docs P2 Docs Learn Events
GPS module — Parallax Forums

GPS module

Also in my delivery I got the GPS module. Since I am using SimpleIDE, anybody have any working C code for the module.

Thanks

Ray

Comments

  • If the GPS module is supported in Blockly, then you'd find example code and drivers in the latest Simple Libraries workspace.
  • I do not do Blockly, but I will look at the code, not sure how far I will get with that.

    Ray
  • In SimpleIDE, try:
    #include "simpletools.h"
    #include "gps.h"
    
    // ------ Main Program ------
    int main() {
    
      gps_open(0, 32, 9600);
      pause(100);
      print("Starting...");
      print("%s%d\r", "GPS: ", (int)(gps_longitude() * 1000000));
    
    }
    
    This is what BlocklyProp Solo created as C code from a simple GPS block. Look in SimpleIDE's gps lib directory for more options.
    /Learn/Simple Libraries/Sensor/libgps

    dgately
  • Thanks dgately. First thing I did was look in the SimpleIDE's gps lib directory, saw at lot of command options, but did not see any example setup code. It looks like Parallax is minimizing support for SimpleIDE.

    I will not be using Spin/Spin2 or Blockly, so it looks like my options are starting to become very narrow. Switching over to FleGUI is still to early, FlexGUI has a long way to go, in terms of accessing simpletools lib.

    Ray
  • Use this as a guide for what you can do with the GPS (this is how I created the C example):
    BlocklyGPS.png
    You'll just have to write bits of C code in place of those GPS library function blocks that BlocklyProp provided.

    Like:
    gps_latitude()
    gps_altitude()
    gps_heading()
    gps_speed()
    etc...
    
    1078 x 576 - 198K
  • There's a C example here : https://github.com/parallaxinc/Simple-Libraries/tree/master/Learn/Examples/Devices/Sensor/GPS

    And another one here : https://github.com/parallaxinc/Simple-Libraries/blob/master/Learn/Simple Libraries/Sensor/libgps/libgps.c

    You could try those two. They were originally written for an older GPS module, but should still work. If not, they would only need a very minor tweak.

    Thinking about it, the 2nd example is with the current libgps, so I'd expect that to work straight off the bat.

Sign In or Register to comment.