From 5436a4c1afadd7edbe1a5d7bf2977a225834ed6d Mon Sep 17 00:00:00 2001 From: Brian Genisio Date: Sun, 10 Apr 2016 21:40:07 -0400 Subject: [PATCH] Adding docs and examples for the LED pins --- eg/onboard-led.js | 19 +++++++++++++++++++ readme.md | 9 +++++++++ 2 files changed, 28 insertions(+) create mode 100644 eg/onboard-led.js diff --git a/eg/onboard-led.js b/eg/onboard-led.js new file mode 100644 index 0000000..ca4f78c --- /dev/null +++ b/eg/onboard-led.js @@ -0,0 +1,19 @@ +// global.IS_TEST_ENV = true; +var Tessel = require("../lib/tessel.js"); +var board = new Tessel(); + +board.on("ready", function() { + console.log("Ready"); + + var leds = ["L0", "L1", "L2", "L3"]; + + leds.forEach(function(pin) { + this.digitalWrite(pin, this.HIGH); + }.bind(this)); + + setTimeout(function() { + leds.forEach(function(pin) { + this.digitalWrite(pin, this.LOW); + }.bind(this)); + }.bind(this), 1000); +}); diff --git a/readme.md b/readme.md index a13dcfc..4ab8014 100644 --- a/readme.md +++ b/readme.md @@ -33,6 +33,7 @@ board.on("ready", function() { ``` ## Pin Naming Guide +There are two primary ports on the Tessel2: Port "A" and Port "B". There is also a bank of onboard LEDs which are controllable from a port we are calling "L". Note that "L0" and "L1" should be reserved for system functions (ERR and WLAN) so you should avoid using them. Instead, consider using "L2" and "L3" which are intended to be more informational in nature. | Port | Number | Johnny-Five Compatible Name | |------|--------|-----------------------------| @@ -52,6 +53,10 @@ board.on("ready", function() { |B|5|`"b5"` or `"B5"`| |B|6|`"b6"` or `"B6"`| |B|7|`"b7"` or `"B7"`| +|L|0|`"l0"` or `"L0"`| +|L|1|`"l1"` or `"L1"`| +|L|2|`"l2"` or `"L2"`| +|L|3|`"l3"` or `"L3"`| See [examples](https://github.com/rwaldron/tessel-io/tree/master/eg) for basic, non-Johnny-Five examples. @@ -80,6 +85,10 @@ See [examples](https://github.com/rwaldron/tessel-io/tree/master/eg) for basic, |B | 5 | ✓ | | | | | | ✓ | | ✓ | | |B | 6 | ✓ | | | | | | | ✓ | ✓ | | |B | 7 | ✓ | | | | | | | | ✓ | ✓ | +|L | 0 | ✓ (out only)| | | | | | | | | | +|L | 1 | ✓ (out only)| | | | | | | | | | +|L | 2 | ✓ (out only)| | | | | | | | | | +|L | 3 | ✓ (out only)| | | | | | | | | |