-
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
12 changed files
with
229 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!--remove-start--> | ||
|
||
# Servo - Multi-Turn | ||
|
||
<!--remove-end--> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Run this example from the command line with: | ||
```bash | ||
node eg/servo-multi-turn.js | ||
``` | ||
|
||
|
||
```javascript | ||
var five = require("johnny-five"); | ||
var board = new five.Board(); | ||
|
||
board.on("ready", function() { | ||
var servo = new five.Servo({ | ||
pin: 10, | ||
// Cheapo servo has limited PWM range | ||
pwmRange: [600, 2370], | ||
// This multi-turn servo can turn 2430 degrees or 6.75 revolutions | ||
deviceRange: [0, 2430] | ||
}); | ||
|
||
// Add servo to REPL (optional) | ||
this.repl.inject({ | ||
servo: servo | ||
}); | ||
|
||
|
||
// Servo API | ||
|
||
// min() | ||
// | ||
// move the servo to its minimum position | ||
// | ||
// eg. servo.min(); | ||
|
||
// max() | ||
// | ||
// move the servo to its maximum position of 6.75 turns from the minimum | ||
// | ||
// eg. servo.max(); | ||
|
||
// center() | ||
// | ||
// centers the servo at 3 3/8 turns from the minimum | ||
// | ||
// servo.center(); | ||
|
||
// to( deg ) | ||
// | ||
// Moves the servo to 2 whole turns from the minimum | ||
// | ||
// servo.to( 720 ); | ||
|
||
}); | ||
|
||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
| ||
|
||
<!--remove-start--> | ||
|
||
## License | ||
Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com> | ||
Licensed under the MIT license. | ||
Copyright (c) 2018 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,45 @@ | ||
var five = require("../lib/johnny-five.js"); | ||
var board = new five.Board(); | ||
|
||
board.on("ready", function() { | ||
var servo = new five.Servo({ | ||
pin: 10, | ||
// Cheapo servo has limited PWM range | ||
pwmRange: [600, 2370], | ||
// This multi-turn servo can turn 2430 degrees or 6.75 revolutions | ||
deviceRange: [0, 2430] | ||
}); | ||
|
||
// Add servo to REPL (optional) | ||
this.repl.inject({ | ||
servo: servo | ||
}); | ||
|
||
|
||
// Servo API | ||
|
||
// min() | ||
// | ||
// move the servo to its minimum position | ||
// | ||
// eg. servo.min(); | ||
|
||
// max() | ||
// | ||
// move the servo to its maximum position of 6.75 turns from the minimum | ||
// | ||
// eg. servo.max(); | ||
|
||
// center() | ||
// | ||
// centers the servo at 3 3/8 turns from the minimum | ||
// | ||
// servo.center(); | ||
|
||
// to( deg ) | ||
// | ||
// Moves the servo to 2 whole turns from the minimum | ||
// | ||
// servo.to( 720 ); | ||
|
||
}); |
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
Oops, something went wrong.