Skip to content

Commit

Permalink
Keypad: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Jul 3, 2015
1 parent 2dc685e commit 785b263
Show file tree
Hide file tree
Showing 11 changed files with 397 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ To interactively navigate the examples, visit the [Johnny-Five examples](http://
- [Button - Pullup](https://github.com/rwaldron/johnny-five/blob/master/docs/button-pullup.md)
- [Toggle Switch](https://github.com/rwaldron/johnny-five/blob/master/docs/toggle-switch.md)

### Keypad
- [Keypad - VKEY](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-analog-vkey.md)
- [Keypad - Waveshare AD](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-analog-ad.md)
- [Keypad - MPR121](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121.md)
- [Keypad - MPR121QR2](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121QR2.md)

### Relay
- [Relay](https://github.com/rwaldron/johnny-five/blob/master/docs/relay.md)

Expand Down
Binary file added docs/breadboard/keypad-MPR121.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/breadboard/keypad-MPR121QR2.fzz
Binary file not shown.
Binary file added docs/breadboard/keypad-MPR121QR2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/breadboard/keypad-analog-ad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/breadboard/keypad-analog-vkey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions docs/keypad-MPR121.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!--remove-start-->

# Keypad - MPR121

<!--remove-end-->






##### Breadboard for "Keypad - MPR121"



![docs/breadboard/keypad-MPR121.png](breadboard/keypad-MPR121.png)<br>

&nbsp;




Run with:
```bash
node eg/keypad-MPR121.js
```


```javascript
var exec = require("child_process").exec;
var argv = require("minimist")(process.argv.slice(2), { default: { show: 1 } });
var five = require("../");
var board = new five.Board();

board.on("ready", function() {
// MPR121 3x4 Capacitive Touch Pad
var keypad;

if (argv.show === 1) {
keypad = new five.Keypad({
controller: "MPR121"
});
}

if (argv.show === 2) {
keypad = new five.Keypad({
controller: "MPR121",
keys: [
["!", "@", "#"],
["$", "%", "^"],
["&", "-", "+"],
["_", "=", ":"]
]
});
}

if (argv.show === 3) {
keypad = new five.Keypad({
controller: "MPR121",
keys: ["!", "@", "#", "$", "%", "^", "&", "-", "+", "_", "=", ":"]
});
}

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
});
});
});

```








&nbsp;

<!--remove-start-->

## License
Copyright (c) 2012, 2013, 2014 Rick Waldron <[email protected]>
Licensed under the MIT license.
Copyright (c) 2014, 2015 The Johnny-Five Contributors
Licensed under the MIT license.

<!--remove-end-->
91 changes: 91 additions & 0 deletions docs/keypad-MPR121QR2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!--remove-start-->

# Keypad - MPR121QR2

<!--remove-end-->






##### Breadboard for "Keypad - MPR121QR2"



![docs/breadboard/keypad-MPR121QR2.png](breadboard/keypad-MPR121QR2.png)<br>

Fritzing diagram: [docs/breadboard/keypad-MPR121QR2.fzz](breadboard/keypad-MPR121QR2.fzz)

&nbsp;




Run with:
```bash
node eg/keypad-MPR121QR2.js
```


```javascript
var exec = require("child_process").exec;
var argv = require("minimist")(process.argv.slice(2), { default: { show: 1 } });
var five = require("../");
var board = new five.Board();

board.on("ready", function() {
// MPR121QR2 3x3 Capacitive Touch Shield
var keypad;

if (argv.show === 1) {
keypad = new five.Keypad({
controller: "MPR121QR2"
});
}

if (argv.show === 2) {
keypad = new five.Keypad({
controller: "MPR121QR2",
keys: [
["!", "@", "#"],
["$", "%", "^"],
["&", "-", "+"],
]
});
}

if (argv.show === 3) {
keypad = new five.Keypad({
controller: "MPR121QR2",
keys: ["!", "@", "#", "$", "%", "^", "&", "-", "+"]
});
}

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
});
});
});

```








&nbsp;

<!--remove-start-->

## License
Copyright (c) 2012, 2013, 2014 Rick Waldron <[email protected]>
Licensed under the MIT license.
Copyright (c) 2014, 2015 The Johnny-Five Contributors
Licensed under the MIT license.

<!--remove-end-->
93 changes: 93 additions & 0 deletions docs/keypad-analog-ad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--remove-start-->

# Keypad - Waveshare AD

<!--remove-end-->






##### Breadboard for "Keypad - Waveshare AD"



![docs/breadboard/keypad-analog-ad.png](breadboard/keypad-analog-ad.png)<br>

&nbsp;




Run with:
```bash
node eg/keypad-analog-ad.js
```


```javascript
var exec = require("child_process").exec;
var argv = require("minimist")(process.argv.slice(2), { default: { show: 1 } });
var five = require("../");
var board = new five.Board();

board.on("ready", function() {
// WaveShare AD Keypad
var keypad;

if (argv.show === 1) {
keypad = new five.Keypad({
pin: "A0",
length: 16
});
}

if (argv.show === 2) {
keypad = new five.Keypad({
pin: "A0",
keys: [
["1", "!", "@", "#"],
["2", "$", "%", "^"],
["3", "&", "-", "+"],
["4", "<", ">", "?"],
]
});
}

if (argv.show === 3) {
keypad = new five.Keypad({
pin: "A0",
keys: ["1", "!", "@", "#", "2", "$", "%", "^", "3", "&", "-", "+", "4", "<", ">", "?"]
});
}

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
});
});
});



```








&nbsp;

<!--remove-start-->

## License
Copyright (c) 2012, 2013, 2014 Rick Waldron <[email protected]>
Licensed under the MIT license.
Copyright (c) 2014, 2015 The Johnny-Five Contributors
Licensed under the MIT license.

<!--remove-end-->
95 changes: 95 additions & 0 deletions docs/keypad-analog-vkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!--remove-start-->

# Keypad - VKEY

<!--remove-end-->






##### Breadboard for "Keypad - VKEY"



![docs/breadboard/keypad-analog-vkey.png](breadboard/keypad-analog-vkey.png)<br>

&nbsp;




Run with:
```bash
node eg/keypad-analog-vkey.js
```


```javascript
var exec = require("child_process").exec;
var argv = require("minimist")(process.argv.slice(2), { default: { show: 1 } });
var five = require("../");
var board = new five.Board();

board.on("ready", function() {
// Sparkfun's VKey Voltage Keypad
var keypad;

if (argv.show === 1) {
keypad = new five.Keypad({
controller: "VKEY",
pin: "A0",
});
}

if (argv.show === 2) {
keypad = new five.Keypad({
controller: "VKEY",
pin: "A0",
keys: [
["!", "@", "#"],
["$", "%", "^"],
["&", "-", "+"],
["<", ">", "?"],
]
});
}

if (argv.show === 3) {
keypad = new five.Keypad({
controller: "VKEY",
pin: "A0",
keys: ["!", "@", "#", "$", "%", "^", "&", "-", "+", "<", ">", "?"]
});
}

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
});
});
});



```








&nbsp;

<!--remove-start-->

## License
Copyright (c) 2012, 2013, 2014 Rick Waldron <[email protected]>
Licensed under the MIT license.
Copyright (c) 2014, 2015 The Johnny-Five Contributors
Licensed under the MIT license.

<!--remove-end-->
Loading

0 comments on commit 785b263

Please sign in to comment.