Cassy is an wrapper for libcassy to access some functions of the cassy devices from Leybold Didactic.
- Cassy Sensor 1/2
- Powercassy
init device:
var cassy = require('cassy'),
dev = cassy('/dev/ldusb0');
var INPUT_A = 0;
var RANGE_10V = 168;
get one value:
dev.GetValue(INPUT_A, RANGE_10V, function(value) {
console.log(value+'V');
});
get multiple values:
dev.GetValues(INPUT_A, RANGE_10V, 200*1000 /*num*/, 10 /*mics*/, function(buffer) {
var i = buf.length/4;
while(i+1 > 0) {
console.log(buf.readFloatLE(i));
i -= 4;
}
});
create a value stream:
var s = dev.GetValuesStream(INPUT_A, RANGE_10V, 1000 /*mics*/);
s.on('data', function(buf) {
console.log("Num: "+buf.length/4+"; First value: "+buf.readFloatLE(0));
});
Capture a single value and return it as a float.
Record num values, each with the given time delta to the next. They will be returned in a single buffer because of performance reasons, javascript arrays are really slow :( The buffer contains 32bit floats therefore you can get them with readFloatLE(4/bytes/ * id)
Create a readable stream which measures values in dt. You shouldn't choose dt too small because then it won't be realtime.
Upload an array of values to the Powercassy device
Start output the uploaded function.
Stop output the uploaded function.
Switch the builtin relay to a given state
PowerOff/On the bultin power source
Change the brightness of the intern LEDs (can be used for fancy stuff :D)
With npm do:
npm install cassy