-
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.
Compass: MAG3110 (incl. tests & diagrams)
Signed-off-by: Rick Waldron <[email protected]>
- Loading branch information
Showing
13 changed files
with
780 additions
and
170 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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!--remove-start--> | ||
|
||
# Compass - MAG3110 on Tessel 2 | ||
|
||
<!--remove-end--> | ||
|
||
|
||
|
||
|
||
|
||
|
||
##### Breadboard for "Compass - MAG3110 on Tessel 2" | ||
|
||
|
||
|
||
![docs/breadboard/compass-MAG3110-tessel.png](breadboard/compass-MAG3110-tessel.png)<br> | ||
|
||
Fritzing diagram: [docs/breadboard/compass-MAG3110-tessel.fzz](breadboard/compass-MAG3110-tessel.fzz) | ||
|
||
| ||
|
||
|
||
|
||
|
||
Run this example from the command line with: | ||
```bash | ||
node eg/compass-MAG3110-tessel.js | ||
``` | ||
|
||
|
||
```javascript | ||
var Tessel = require("tessel-io"); | ||
var five = require("../"); | ||
var board = new five.Board({ | ||
io: new Tessel() | ||
}); | ||
|
||
board.on("ready", function() { | ||
|
||
var compass = new five.Compass({ | ||
controller: "MAG3110", | ||
// Optionally pre-load the offsets | ||
offsets: { | ||
x: [-819, -335], | ||
y: [702, 1182], | ||
z: [-293, -13], | ||
}, | ||
}); | ||
|
||
compass.on("calibrated", function(offsets) { | ||
// Use this data with the optional "offsets" property above | ||
console.log("calibrated:", offsets); | ||
}); | ||
|
||
compass.on("change", function() { | ||
console.log("change"); | ||
console.log(" heading : ", Math.floor(this.heading)); | ||
console.log(" bearing : ", this.bearing.name); | ||
console.log("--------------------------------------"); | ||
}); | ||
}); | ||
|
||
|
||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
| ||
|
||
<!--remove-start--> | ||
|
||
## License | ||
Copyright (c) 2012, 2013, 2014 Rick Waldron <[email protected]> | ||
Licensed under the MIT license. | ||
Copyright (c) 2016 The Johnny-Five Contributors | ||
Licensed under the MIT license. | ||
|
||
<!--remove-end--> |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!--remove-start--> | ||
|
||
# Compass - MAG3110 | ||
|
||
<!--remove-end--> | ||
|
||
|
||
|
||
|
||
|
||
|
||
##### Breadboard for "Compass - MAG3110" | ||
|
||
|
||
|
||
![docs/breadboard/compass-MAG3110.png](breadboard/compass-MAG3110.png)<br> | ||
|
||
Fritzing diagram: [docs/breadboard/compass-MAG3110.fzz](breadboard/compass-MAG3110.fzz) | ||
|
||
| ||
|
||
|
||
|
||
|
||
Run this example from the command line with: | ||
```bash | ||
node eg/compass-MAG3110.js | ||
``` | ||
|
||
|
||
```javascript | ||
var five = require("../"); | ||
var board = new five.Board(); | ||
|
||
board.on("ready", function() { | ||
|
||
var compass = new five.Compass({ | ||
controller: "MAG3110", | ||
// Optionally pre-load the offsets | ||
offsets: { | ||
x: [-819, -335], | ||
y: [702, 1182], | ||
z: [-293, -13], | ||
}, | ||
}); | ||
|
||
compass.on("calibrated", function(offsets) { | ||
// Use this data with the optional "offsets" property above | ||
console.log("calibrated:", offsets); | ||
}); | ||
|
||
compass.on("change", function() { | ||
console.log("change"); | ||
console.log(" heading : ", Math.floor(this.heading)); | ||
console.log(" bearing : ", this.bearing.name); | ||
console.log("--------------------------------------"); | ||
}); | ||
}); | ||
|
||
|
||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
| ||
|
||
<!--remove-start--> | ||
|
||
## License | ||
Copyright (c) 2012, 2013, 2014 Rick Waldron <[email protected]> | ||
Licensed under the MIT license. | ||
Copyright (c) 2016 The Johnny-Five Contributors | ||
Licensed under the MIT license. | ||
|
||
<!--remove-end--> |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var Tessel = require("tessel-io"); | ||
var five = require("../"); | ||
var board = new five.Board({ | ||
io: new Tessel() | ||
}); | ||
|
||
board.on("ready", function() { | ||
|
||
var compass = new five.Compass({ | ||
controller: "MAG3110", | ||
// Optionally pre-load the offsets | ||
offsets: { | ||
x: [-819, -335], | ||
y: [702, 1182], | ||
z: [-293, -13], | ||
}, | ||
}); | ||
|
||
compass.on("calibrated", function(offsets) { | ||
// Use this data with the optional "offsets" property above | ||
console.log("calibrated:", offsets); | ||
}); | ||
|
||
compass.on("change", function() { | ||
console.log("change"); | ||
console.log(" heading : ", Math.floor(this.heading)); | ||
console.log(" bearing : ", this.bearing.name); | ||
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var five = require("../"); | ||
var board = new five.Board(); | ||
|
||
board.on("ready", function() { | ||
|
||
var compass = new five.Compass({ | ||
controller: "MAG3110", | ||
// Optionally pre-load the offsets | ||
offsets: { | ||
x: [-819, -335], | ||
y: [702, 1182], | ||
z: [-293, -13], | ||
}, | ||
}); | ||
|
||
compass.on("calibrated", function(offsets) { | ||
// Use this data with the optional "offsets" property above | ||
console.log("calibrated:", offsets); | ||
}); | ||
|
||
compass.on("change", function() { | ||
console.log("change"); | ||
console.log(" heading : ", Math.floor(this.heading)); | ||
console.log(" bearing : ", this.bearing.name); | ||
console.log("--------------------------------------"); | ||
}); | ||
}); | ||
|
Oops, something went wrong.