-
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.
Relay: add test and example program for use with analog pin.
- Loading branch information
Showing
8 changed files
with
215 additions
and
9 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.
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,65 @@ | ||
<!--remove-start--> | ||
|
||
# Relay On Analog Pin | ||
|
||
<!--remove-end--> | ||
|
||
|
||
|
||
|
||
|
||
|
||
##### Breadboard for "Relay On Analog Pin" | ||
|
||
|
||
|
||
![docs/breadboard/relay-on-analog-pin.png](breadboard/relay-on-analog-pin.png)<br> | ||
|
||
Fritzing diagram: [docs/breadboard/relay-on-analog-pin.fzz](breadboard/relay-on-analog-pin.fzz) | ||
|
||
| ||
|
||
|
||
|
||
|
||
Run this example from the command line with: | ||
```bash | ||
node eg/relay-on-analog-pin.js | ||
``` | ||
|
||
|
||
```javascript | ||
var five = require('../'); | ||
var board = new five.Board(); | ||
|
||
board.on('ready', function() { | ||
|
||
var relay = new five.Relay({ | ||
pin: "A2" | ||
}); | ||
|
||
setInterval(function() { | ||
relay.toggle(); | ||
}, 1000); | ||
}); | ||
|
||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
| ||
|
||
<!--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,13 @@ | ||
var five = require('../'); | ||
var board = new five.Board(); | ||
|
||
board.on('ready', function() { | ||
|
||
var relay = new five.Relay({ | ||
pin: "A2" | ||
}); | ||
|
||
setInterval(function() { | ||
relay.toggle(); | ||
}, 1000); | ||
}); |
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