cassy

0.1.1 • Public • Published

cassy

Cassy is an wrapper for libcassy to access some functions of the cassy devices from Leybold Didactic.

supported devices

  • Cassy Sensor 1/2
  • Powercassy

example

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));
});

methods

GetValue(input, range, cb)

Capture a single value and return it as a float.

GetValues(input, range, num, dt /mics/, cb)

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)

var s = GetValuesStream(input, range, dt)

Create a readable stream which measures values in dt. You shouldn't choose dt too small because then it won't be realtime.

DefineFunction(amplitude, frequency, values_arr)

Upload an array of values to the Powercassy device

StartFunction()

Start output the uploaded function.

StopFunction()

Stop output the uploaded function.

SetRelay(state)

Switch the builtin relay to a given state

SetVoltage(state)

PowerOff/On the bultin power source

SetLEDValue(mode, value)

Change the brightness of the intern LEDs (can be used for fancy stuff :D)

install

With npm do:

npm install cassy

Readme

Keywords

none

Package Sidebar

Install

npm i cassy

Weekly Downloads

2

Version

0.1.1

License

none

Last publish

Collaborators

  • bytesnake