0

New to this Pi world and what not but I know some JS and am using the Johnny-Five library.

I used raspi-config to disable Serial/USB Console and Enabled Serial interface. I've also added enable_uart=1 config.txt.

Running cat /dev/serial0 from the command like outputs a stream of data from the GPS unit and seems to be doing it's job. Nonetheless, I'm having an issue with Pin 10 receiving data from the GPS Unit. When I run my code below it throws the error:

Error: Pin "10" does not support mode "other"

var five = require("johnny-five");
var Raspi = require("raspi-io");
var board = new five.Board({
  io : new Raspi({ enableSerial : true /* apparently required as per raspi-io docs */ })
});

    board.on("ready", function() {
        const gps = new five.GPS({
            pins : {
                    rx : 'P1-10',
                    tx : 'P1-8',
            }
    });

    gps.on("data", () => {
            console.log("position");
            console.log(" latitude  : ", this.latitude);
            console.log(" longitude : ", this.longitude);
            console.log(" altitude  : ", this.altitude);
            console.log("———————————————————————————————————");
    });

});
  • With the GPS attached, do you get output when you do cat /dev/ttyS0? – stevieb May 24 '17 at 22:05
  • I do not. I get a response of : cat: /dev/ttyS0: Input/output error – heyron May 24 '17 at 22:41
  • I would suggest you ignore that rant you linked. If you want a technical explanation read How-do-i-make-serial-work-on-the-raspberry-pi3. You DO NOT need to fiddle with any files, raspi-config will enable serial. You have NOT told us what you actually did. NOTE you should use /dev/serial0 rather than any other designation. – Milliways May 24 '17 at 23:18
  • Thank you for that link. Will go through it more thoroughly. In short, I made the minor edits to config.txt - added "enable_uart=1" no changes to cmdline.txt. I went through raspi-config to enable serial. this might seem a bit ignorant but how do i use /dev/serial0 from within a node app? – heyron May 24 '17 at 23:45
  • Kind of answered my own question on where /dev/serial0 is accessed - they're pins 14/15 at physical locations 8 and 10. the issue still stands that the pin does not support mode 'other' which i can't seem to find a definitive answer for – heyron May 25 '17 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.