Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 72 lines (52 sloc) 1.412 kb
329525f Rick Waldron Add removal delimiters to eg template. Update examples
authored
1 <!--remove-start-->
e08f482 Rick Waldron Regenerate examples with improved titles
authored
2 # Button - Options
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
3
4 Run with:
5 ```bash
6 node eg/button-options.js
7 ```
329525f Rick Waldron Add removal delimiters to eg template. Update examples
authored
8 <!--remove-end-->
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
9
10 ```javascript
11 var five = require("johnny-five"),
ca469ef Rick Waldron Regenerate all of the doc/example files
authored
12 board, button;
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
13
14 board = new five.Board();
15
16 board.on("ready", function() {
17
18 // Create a new `button` hardware instance
19 button = new five.Button({
20 board: board,
21 pin: 7,
d68456b Rick Waldron regenerated docs, thanks @mharsch!
authored
22 holdtime: 1000,
23 invert: false // Default: "false". Set to "true" if button is Active-Low
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
24 });
25
26 // Inject the `button` hardware into
27 // the Repl instance's context;
28 // allows direct command line access
29 board.repl.inject({
30 button: button
31 });
32
33 // Button Event API
34
35 // "down" the button is pressed
36 button.on("down", function() {
37 console.log("down");
38 });
39
40 // "hold" the button is pressed for specified time.
41 // defaults to 500ms (1/2 second)
42 // set
43 button.on("hold", function() {
44 console.log("hold");
45 });
46
47 // "up" the button is released
48 button.on("up", function() {
49 console.log("up");
50 });
51 });
52
53 ```
54
938e295 Rick Waldron Removes @device tags and replaces with arbitrary @markdown regions
authored
55
1b7af18 Rick Waldron Change "Breadboard" heading to "Breadboard/Illustration"
authored
56 ## Breadboard/Illustration
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
57
938e295 Rick Waldron Removes @device tags and replaces with arbitrary @markdown regions
authored
58
51b65fd Adam Hyland Update docs to use relative links.
Protonk authored
59 ![docs/breadboard/button-options.png](breadboard/button-options.png)
60 [docs/breadboard/button-options.fzz](breadboard/button-options.fzz)
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
61
62
5e929ce Rick Waldron Example program updates
authored
63
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
64
329525f Rick Waldron Add removal delimiters to eg template. Update examples
authored
65 <!--remove-start-->
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
66 ## License
8c167ba Rick Waldron Update copyright year
authored
67 Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com>
6ee1faa Rick Waldron Regenerate the docs examples
authored
68 Licensed under the MIT license.
8c167ba Rick Waldron Update copyright year
authored
69 Copyright (c) 2014, 2015 The Johnny-Five Contributors
6b5ab5b Rick Waldron Rebuild all example program markdown files
authored
70 Licensed under the MIT license.
329525f Rick Waldron Add removal delimiters to eg template. Update examples
authored
71 <!--remove-end-->
Something went wrong with that request. Please try again.