1 year ago

#350926

test-img

jetLagMan

Adafruit ultimate gps breakout v3 with beaglebone black using johnny-five and beaglebone-io dependencies

I am following a sample demo from J5 (http://johnny-five.io/examples/gps/) where they use an arduino to communicate with the Adafruit module. In my case, I am using a Beaglebone black and I adapt this code with the official dependency called beaglebone-io (https://www.npmjs.com/package/beaglebone-io).

But i got this error:

1648574209682 Available BeagleBone-IO 
1648574209720 Connected BeagleBone-IO 
1648574209756 Repl Initialized 
>> /home/debian/Desktop/devel/iot/node_modules/linux-io/lib/linux-io.js:93
      throw new Error('Mode ' + mode + ' is not supported');
      ^

Error: Mode undefined is not supported
    at BeagleBone.LinuxIO.pinMode (/home/debian/Desktop/devel/iot/node_modules/linux-io/lib/linux-io.js:93:13)
    at /home/debian/Desktop/devel/iot/node_modules/johnny-five/lib/gps.js:271:17
    at Array.forEach (<anonymous>)
    at GPS.initialize (/home/debian/Desktop/devel/iot/node_modules/johnny-five/lib/gps.js:269:18)
    at new GPS (/home/debian/Desktop/devel/iot/node_modules/johnny-five/lib/gps.js:247:12)
    at Board.<anonymous> (/home/debian/Desktop/devel/iot/testGps.js:18:13)
    at Board.emit (events.js:326:22)
    at /home/debian/Desktop/devel/iot/node_modules/johnny-five/lib/board.js:428:39
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

I navigated through the dependencies files found on github and i couln't found any clue.

Any ideas ?

Here is my code:

const { Board, GPS } = require("johnny-five");
const BeagleBone = require('beaglebone-io');

const board = new Board({
        io: new BeagleBone()
});

board.on("ready", () => {

  /*
   * This is the simplest initialization
   * We assume SW_SERIAL0 for the port
   */

  var gps = new GPS({
        pins: { rx: 'P9_26', tx: 'P9_24' }
  });

  // If latitude, longitude change log it
   gps.on("change", position => {
    const {altitude, latitude, longitude} = position;
    console.log("GPS Position:");
    console.log("  latitude   : ", position.latitude);
    console.log("  longitude  : ", position.longitude);
    console.log("  altitude   : ", position.altitude);
    console.log("--------------------------------------");
  });

  // If speed, course change log it
  gps.on("navigation", velocity => {
    const {course, speed} = velocity;
    console.log("GPS Navigation:");
    console.log("  course  : ", course);
    console.log("  speed   : ", speed);
    console.log("--------------------------------------");
  });

});

javascript

gps

beagleboneblack

adafruit

0 Answers

Your Answer

Accepted video resources