• Use this piece of code to check on GPS's output. Upload and start with entering onInit() in the console.

    // monitorPin.js
    var led = LED1;
    var pin = B7;
    var debounce = 5;
    var watchId = null;
    pinMode(pin,"input_pullup");
    function out(evt) { digitalWrite(led,evt.state); }
    function startWatching() {
      setWatch(out,pin,{ repeat:true, edge:"both", debounce: debounce });
      led.set();
    }
    function stopWatching() {
      if (watchId) watchId = clearWatch(watchId);
    }
    function onInit() {
      startWatching();
    }
    

    The red LED - LED1 - comes on. Then you can probe with a wire connected to the pin the GPS output (TX). If GPS sends something, TX is going low for the start bit and the LED goes out. You can play with the debounce value. Espruino is not fast enough to catch all 9600 baud changes and the event buffer may overflow... but you will get for sure some reaction when the GPS actually sends something.

    You may also use some other methods of recording what's going on at a pin, such as the way to record the IR remote control signal (see []()):

    // recordOnPin.js
    pinMode(D28,"input_pullup");
    var d = [];
    var w = null;
    c = 2000; // number signal changes to catch / record
    function record() {
      w = setWatch(function(e) {
        d.push(e.time-e.lastTime);
        if (!(--c)) stop();
      }, D28, {edge:"both",repeat:true});
    }
    function stop() {
      clearWatch(w);
      console.log(d.map(a=>(a*1000).toFixed(1)­).toString()); // display recorded times
    }
    onInit() {
      record();
    }
    

    Looking at the times you may even determine the baud rate.

    (I'm sure you came across my posts about GPS:

    Third one - I guess - is not what you are heading for, because this lead me to this question:

    How do you power the GPS? ...are you using puck's power? ...this could be a reason that the GPS module does not get enough power and puck may even brown out... (when button cell is not fresh anymore). After all, GPS is a bit power hungry when starting... as you can read in the post about powering the GPS by pins in order to be able to shut it down completely...

About

Avatar for allObjects @allObjects started