Skip to content

Commit

Permalink
Keypad: complete upgrade to multi-touch
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Mar 10, 2016
1 parent 9b19580 commit e8229a0
Show file tree
Hide file tree
Showing 32 changed files with 909 additions and 274 deletions.
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -285,10 +285,12 @@ To interactively navigate the examples, visit the [Johnny-Five examples](http://
### 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 - MPR121, Sensitivity](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121-sensitivity.md)
- [Keypad - MPR121QR2](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121QR2.md)
- [Keypad - Grove QTouch](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-QTOUCH.md)
- [Touchpad - MPR121](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121.md)
- [Touchpad - MPR121_SHIELD](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121_SHIELD.md)
- [Touchpad - MPR121_KEYPAD](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121_KEYPAD.md)
- [Touchpad - MPR121, Sensitivity](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121-sensitivity.md)
- [Touchpad - MPR121QR2_SHIELD](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-MPR121QR2_SHIELD.md)
- [Touchpad - Grove QTouch](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-QTOUCH.md)
- [Keypad - 3x4 I2C Nano Backpack](https://github.com/rwaldron/johnny-five/blob/master/docs/keypad-3X4_I2C_NANO_BACKPACK.md)

### Relay
Expand Down
Binary file added docs/breadboard/keypad-MPR121.fzz
Binary file not shown.
Binary file modified docs/breadboard/keypad-MPR121.png
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_SHIELD.fzz
Binary file not shown.
Binary file added docs/breadboard/keypad-MPR121QR2_SHIELD.png
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-MPR121_KEYPAD.png
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-MPR121_SHIELD.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/mpr121_shield.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/keypad-3X4_I2C_NANO_BACKPACK.md
Expand Up @@ -67,8 +67,8 @@ board.on("ready", function() {
}

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
keypad.on(eventType, function(event) {
console.log("Event: %s, Target: %s", eventType, event.which);
});
});
});
Expand Down
14 changes: 7 additions & 7 deletions docs/keypad-MPR121-sensitivity.md
@@ -1,6 +1,6 @@
<!--remove-start-->

# Keypad - MPR121, Sensitivity
# Touchpad - MPR121, Sensitivity

<!--remove-end-->

Expand All @@ -13,7 +13,7 @@



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

&nbsp;

Expand All @@ -35,10 +35,10 @@ board.on("ready", function() {
// MPR121 3x4 Capacitive Touch Pad
// Demonstrates increasing the sensitivity
// deviation for touch and release.
var keypad;
var touchpad;

if (argv.show === 1) {
keypad = new five.Keypad({
touchpad = new five.Touchpad({
controller: "MPR121",
sensitivity: {
press: 0.10,
Expand All @@ -48,7 +48,7 @@ board.on("ready", function() {
}

if (argv.show === 2) {
keypad = new five.Keypad({
touchpad = new five.Touchpad({
controller: "MPR121",
sensitivity: {
press: 0.10,
Expand All @@ -64,7 +64,7 @@ board.on("ready", function() {
}

if (argv.show === 3) {
keypad = new five.Keypad({
touchpad = new five.Touchpad({
controller: "MPR121",
sensitivity: {
press: 0.10,
Expand All @@ -75,7 +75,7 @@ board.on("ready", function() {
}

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
touchpad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
});
});
Expand Down
41 changes: 9 additions & 32 deletions docs/keypad-MPR121.md
@@ -1,6 +1,6 @@
<!--remove-start-->

# Keypad - MPR121
# Touchpad - MPR121

<!--remove-end-->

Expand All @@ -9,12 +9,14 @@



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



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

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

&nbsp;


Expand All @@ -27,42 +29,17 @@ node eg/keypad-MPR121.js


```javascript
var argv = require("minimist")(process.argv.slice(2), { default: { show: 1 } });
var five = require("johnny-five");
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: ["!", "@", "#", "$", "%", "^", "&", "-", "+", "_", "=", ":"]
});
}
var touchpad = new five.Touchpad({
controller: "MPR121",
});

["change", "press", "hold", "release"].forEach(function(eventType) {
keypad.on(eventType, function(data) {
console.log("Event: %s, Target: %s", eventType, data.which);
touchpad.on(eventType, function(event) {
console.log("Event: %s, Target: %s", eventType, event.which);
});
});
});
Expand Down
90 changes: 90 additions & 0 deletions docs/keypad-MPR121QR2_SHIELD.md
@@ -0,0 +1,90 @@
<!--remove-start-->

# Touchpad - MPR121QR2_SHIELD

<!--remove-end-->






##### Breadboard for "Touchpad - MPR121QR2_SHIELD"



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

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

&nbsp;




Run this example from the command line with:
```bash
node eg/keypad-MPR121QR2_SHIELD.js
```


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

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

if (argv.show === 1) {
touchpad = new five.Touchpad({
controller: "MPR121QR2_SHIELD"
});
}

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

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

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

```








&nbsp;

<!--remove-start-->

## License
Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com>
Licensed under the MIT license.
Copyright (c) 2016 The Johnny-Five Contributors
Licensed under the MIT license.

<!--remove-end-->
88 changes: 88 additions & 0 deletions docs/keypad-MPR121_KEYPAD.md
@@ -0,0 +1,88 @@
<!--remove-start-->

# Touchpad - MPR121_KEYPAD

<!--remove-end-->






##### Breadboard for "Touchpad - MPR121_KEYPAD"



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

&nbsp;




Run this example from the command line with:
```bash
node eg/keypad-MPR121_KEYPAD.js
```


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

board.on("ready", function() {
var touchpad;

if (argv.show === 1) {
touchpad = new five.Touchpad({
controller: "MPR121_KEYPAD"
});
}

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

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

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

```








&nbsp;

<!--remove-start-->

## License
Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com>
Licensed under the MIT license.
Copyright (c) 2016 The Johnny-Five Contributors
Licensed under the MIT license.

<!--remove-end-->

0 comments on commit e8229a0

Please sign in to comment.