Comparing version 0.0.32 to 0.0.33
@@ -210,7 +210,19 @@ var Board, Promise, assert, events, rfcontrol, settled, | ||
Board.prototype.readDST = function() { | ||
Board.prototype.readDstSensors = function(pin) { | ||
var promise, reading; | ||
reading = this.writeAndWait("DST \n"); | ||
reading = this.writeAndWait("DST " + pin + " sensors\n"); | ||
promise = reading.then(function(args) { | ||
args.shift(); | ||
return { | ||
sensors: args | ||
}; | ||
}); | ||
return promise; | ||
}; | ||
Board.prototype.readDstSensor = function(pin, address) { | ||
var promise, reading; | ||
reading = this.writeAndWait("DST " + pin + " " + address + "\n"); | ||
promise = reading.then(function(args) { | ||
return { | ||
temperature: parseFloat(args) | ||
@@ -222,2 +234,13 @@ }; | ||
Board.prototype.readDstAll = function(pin) { | ||
var promise, reading; | ||
reading = this.writeAndWait("DST " + pin + " all\n"); | ||
promise = reading.then(function(args) { | ||
return { | ||
temperature: parseFloat(args[0]) | ||
}; | ||
}); | ||
return promise; | ||
}; | ||
Board.prototype.rfControlStartReceiving = function(pin) { | ||
@@ -224,0 +247,0 @@ assert(typeof pin === "number", "pin should be a number"); |
{ | ||
"name": "homeduino", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "Node.js library for interfacing with the homeduino ardunio library", | ||
@@ -25,2 +25,5 @@ "main": "index.js", | ||
"author": "Oliver Schneider <oliverschneider89+sweetpi@gmail.com>", | ||
"contributors": [ | ||
"Ronald Steen <ronald.steen@gmail.com>" | ||
], | ||
"license": "GPLv3", | ||
@@ -27,0 +30,0 @@ "bugs": { |
@@ -32,8 +32,20 @@ homeduinojs | ||
### readDST() | ||
Read a Dallas DS18B20 sensor | ||
### readDstSensors (pin) | ||
Returns all Dallas temp sensors on [pin] | ||
```CoffeeScript | ||
board.readDST().then( (ret) -> | ||
board.readDstSensors(12).then( (ret) -> | ||
console.log ret.sensors | ||
).done() | ||
``` | ||
### readDstSensor (pin, address) | ||
Reads a sensor with [address] on [pin]. | ||
```CoffeeScript | ||
board.readDstSensor(12, '12312312333').then( (ret) -> | ||
console.log ret.temperature | ||
@@ -43,2 +55,14 @@ ).done() | ||
### readDstAll (pin) | ||
Reads all sensors connected to [pin] | ||
```CoffeeScript | ||
board.readDstAll(12).then( (ret) -> | ||
console.log ret.temperatures | ||
).done() | ||
``` | ||
### rfControlStartReceiving(pin) | ||
@@ -45,0 +69,0 @@ |
Sorry, the diff of this file is not supported yet
184860
497
121