From 7589e7b916733ddd94f43767afafdcb9cf9aa789 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 28 Dec 2015 13:09:30 +0100 Subject: [PATCH] * Added experimental support for Photon boards * Updated dependency on pimatic-plugin-commons --- README.md | 19 +++++++++++++++---- board-manager.coffee | 4 ++++ johnny-five-config-schema.coffee | 11 +++++++++++ package.json | 3 ++- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8433218..3b0ea55 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Logo](https://github.com/mwittig/pimatic-johnny-five/raw/master/assets/images/johnny-five-icon.png) Pimatic Plugin for [Johnny Five](http://johnny-five.io), a Robotics and IoT programming framework. Thanks to -Johnny Five, you can easily integrate a wide range of sensors and actuators attached to an Arduino board or your +Johnny Five, you can easily integrate a wide range of sensors and actuators attached to an Arduino board or your Raspberry Pi. On Arduino, the universal Firmata library is used which implements a protocol for the communication with host computer. Thus, there is no need to modify the Arduino sketch when new sensors or actuators are connected to your Arduino. Johnny Five also supports a variety of [I2C](https://en.wikipedia.org/wiki/I%C2%B2C) and @@ -23,8 +23,8 @@ This version supports the following devices The OLED and LCD display devices are incomplete and, thus, should not be used. They won't do anything useful anyway. -Board-support has been mainly tested with "arduino". More testing for "raspi-io" will follow. The "etherport" -support is highly experimental at the moment. +Board-support has been mainly tested with "arduino". More testing for "raspi-io" will follow. The "etherport" and +"particle-io" support is highly experimental at the moment. ## Getting Started @@ -69,8 +69,19 @@ The configuration for a board is an object comprising the following properties. | Property | Default | Type | Description | |:----------|:----------|:--------|:--------------------------------------------| | id | - | String | Unique identifier used as a reference by a device configuration | -| boardType | "arduino" | String | The type of board, one of "arduino", "raspi-io", "etherport" | +| boardType | "arduino" | String | The type of board, see supported types below | | port | - | String | Path or name of device port | +| token | - | String | Particle token. Only required for particle-io board type | +| deviceId | - | String | Particle device id. Only required for particle-io board type | + +Supported `boardTypes` +* "arduino" - see +* "raspi-io" - see +* "particle-io" - experimental, should work for + [Particle Photon](http://johnny-five.io/platform-support/#particle-photon) and + [Sparkfun Photon RedBoard](http://johnny-five.io/platform-support/#sparkfun-photon-redboard) +* "etherport" - experimental, works for Arduinos with ethernet or wifi shields, + relay will be provided soon. ## Device Configuration diff --git a/board-manager.coffee b/board-manager.coffee index 16f91ba..0eda9c5 100644 --- a/board-manager.coffee +++ b/board-manager.coffee @@ -84,6 +84,10 @@ module.exports = (env) -> raspi = require 'raspi-io' @board = new BoardWrapper(_.assign({}, options, {io: new raspi(), repl: false})) ) + when 'spark-io' then ( + spark = require 'spark-io' + @board = new BoardWrapper(_.assign({}, options, {io: new spark(), repl: false})) + ) when 'etherport' then ( etherport = require 'etherport' firmata = require('firmata') diff --git a/johnny-five-config-schema.coffee b/johnny-five-config-schema.coffee index 61e96be..7ecdad7 100644 --- a/johnny-five-config-schema.coffee +++ b/johnny-five-config-schema.coffee @@ -22,5 +22,16 @@ module.exports = { description: "Path or name of device port" type: "string" default: "" + token: + description: "Particle token. Only required for particle-io board type" + type: "string" + default: "" + deviceId: + description: "Particle devicde id. Only required for particle-io board type" + type: "string" + default: "" + + + } \ No newline at end of file diff --git a/package.json b/package.json index 4891ef7..04a6185 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,10 @@ "johnny-five": "^0.9.17", "oled-font-5x7": "^1.0.0", "oled-js": "^4.0.1", - "pimatic-plugin-commons": "^0.8.3" + "pimatic-plugin-commons": "^0.8.5" }, "optionalDependencies": { + "particle-io": "^0.12.0", "raspi-io": "^5.0.0" }, "peerDependencies": {