diff --git a/board-manager.coffee b/board-manager.coffee index 0eda9c5..76d29cc 100644 --- a/board-manager.coffee +++ b/board-manager.coffee @@ -78,6 +78,9 @@ module.exports = (env) -> createBoard: (options) -> switch options.boardType || 'arduino' when 'arduino' then ( + if options.port? and options.baudrate? + SerialPort = require('serialport').SerialPort + options.port = new SerialPort(options.port, {baudrate: options.baudrate}) @board = new BoardWrapper(_.assign({}, options, {repl: false})) ) when 'raspi-io' then ( @@ -109,5 +112,5 @@ module.exports = (env) -> return board else error = new Error "Board not found" - _base.error error + @_base.error error throw error \ No newline at end of file diff --git a/johnny-five-config-schema.coffee b/johnny-five-config-schema.coffee index 7ecdad7..3b00de0 100644 --- a/johnny-five-config-schema.coffee +++ b/johnny-five-config-schema.coffee @@ -22,14 +22,18 @@ module.exports = { description: "Path or name of device port" type: "string" default: "" + baudrate: + description: "The baudrate to use for serial communication" + type: "number" + required: false token: description: "Particle token. Only required for particle-io board type" type: "string" - default: "" + required: false deviceId: - description: "Particle devicde id. Only required for particle-io board type" + description: "Particle device id. Only required for particle-io board type" type: "string" - default: "" + required: false diff --git a/package.json b/package.json index 2a268fb..8111390 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ }, "optionalDependencies": { "particle-io": "^0.12.0", - "raspi-io": "^5.0.0" + "raspi-io": "^5.1.0", + "serialport": "^2.0.5" }, "peerDependencies": { "pimatic": "0.8.*"