BroderiKontroll for talking to wireless broderi sensors
read sensor data from slaves (index 12= ann and 13= fredrik) via master (redwirelessmaster).
using LSM303DLH tilt compensated compass.
see also RedWirelessMaster RedThermoKontroll KretsloppKontroll RedUniform KnyppelKontroll
*new(master, slaveIndex)
master - a RedWirelessMaster
slaveIndex - an Integer (only 12 or 13 for now)
<a
3d accelerometer as RedVector3D
<>aaction
action functions that is passed the following arguments...
a - incoming value as RedVector3D
b - previous value as RedVector3D
<alast
holds previous value as RedVector3D
<m
3d magnetometer as RedVector3D
<>maction
action functions that is passed the following arguments...
a - incoming value as RedVector3D
b - previous value as RedVector3D
<mlast
holds previous value as RedVector3D
<h
heading as a Float (0-360).
<hlast
holds previous value as Float.
<haction
action functions that is passed the following arguments...
a - incoming value as Float.
b - previous value as Float.
<>calibration
current automatic magnetometer calibration as an Array. [xmin, xmax, ymin, ymax, zmin, zmax]
reset(xmin= 0, xmax= 0, ymin= 0, ymax= 0, zmin= 0, zmax= 0)
reset calibration for magnetometer.
makeWindow(position, fps)
creates a gui that displays the incoming data.
position - Point
fps - polling speed in frames per second. default 20
close
close window if open.
//--
(
a= RedWirelessMaster("/dev/tty.usbserial-FTDQ2NC0");
b= BroderiKontroll(a, 13); //id
b.aaction= {|val, last| ("accelerometer is"+val).postln};
b.maction= {|val, last| ("magnetometer is"+val).postln};
b.haction= {|val, last| ("heading is"+val).postln};
)
b.debug= true
b.debug= false
b.calibration
b.reset
b.makeWindow;
b.close;
////////////////////////////////////////////
//test reception with sound (geiger counter?)
(
s.waitForBoot{
SynthDef(\ruTest, {|freq= 400, atk= 0.001, rel= 0.01, amp= 0.5, pan= 0|
var e= EnvGen.ar(Env.perc(atk, rel), doneAction:2);
var z= SinOsc.ar(freq, 0, e);
Out.ar(0, Pan2.ar(z, pan, amp));
}).add;
};
)
(
b= BroderiKontroll(RedWirelessMaster.new, 13); //id
b.aaction= {|val, delta| Synth(\ruTest, #[\pan, 1, \freq, 1000])};
b.maction= {|val, delta| Synth(\ruTest, #[\pan, -1, \freq, 2000])};
b.haction= {|val, delta| Synth(\ruTest, #[\pan, 0, \freq, 3000])};
)
b.makeWindow;
b.close;