-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
87 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
var five = require("../lib/johnny-five.js"); | ||
var board = new five.Board(); | ||
const {Board, GPS} = require("../lib/johnny-five.js"); | ||
const board = new Board(); | ||
|
||
board.on("ready", function() { | ||
board.on("ready", () => { | ||
|
||
/* | ||
* Explicitly setting HW_SERIAL1 for the port | ||
*/ | ||
var gps = new five.GPS({ | ||
port: this.io.SERIAL_PORT_IDs.HW_SERIAL1 | ||
const gps = new GPS({ | ||
port: board.io.SERIAL_PORT_IDs.HW_SERIAL1 | ||
}); | ||
|
||
// If latitude, longitude, course or speed change log it | ||
gps.on("change", function() { | ||
gps.on("change", position => { | ||
console.log("position"); | ||
console.log(" latitude : ", this.latitude); | ||
console.log(" longitude : ", this.longitude); | ||
console.log(" latitude : ", position.latitude); | ||
console.log(" longitude : ", position.longitude); | ||
console.log("--------------------------------------"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
var five = require("../lib/johnny-five.js"); | ||
var board = new five.Board(); | ||
const {Board, GPS} = require("../lib/johnny-five.js"); | ||
const board = new Board(); | ||
|
||
board.on("ready", function() { | ||
board.on("ready", () => { | ||
|
||
/* | ||
* This is the simplest initialization | ||
* We assume SW_SERIAL0 for the port | ||
*/ | ||
var gps = new five.GPS({ | ||
var gps = new GPS({ | ||
pins: { | ||
rx: 11, | ||
tx: 10, | ||
} | ||
}); | ||
|
||
// If latitude, longitude change log it | ||
gps.on("change", function() { | ||
gps.on("change", position => { | ||
console.log("position"); | ||
console.log(" latitude : ", this.latitude); | ||
console.log(" longitude : ", this.longitude); | ||
console.log(" altitude : ", this.altitude); | ||
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", function() { | ||
gps.on("navigation", velocity => { | ||
console.log("navigation"); | ||
console.log(" speed : ", this.speed); | ||
console.log(" course : ", this.course); | ||
console.log(" speed : ", velocity.speed); | ||
console.log(" course : ", velocity.course); | ||
console.log("--------------------------------------"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters