|
|
|
@ -25,21 +25,7 @@ projectionWin.view.keyDownAction = { |doc, char, mod, unicode, keycode, key|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Connect arduino; edit first arg / port to match index or name of port: SerialPort.listDevices
|
|
|
|
|
if(~arduino == 1, { arduino_port = SerialPort("/dev/ttyACM0", 115200);
|
|
|
|
|
r= Routine({
|
|
|
|
|
var byte, str, res;
|
|
|
|
|
99999.do{|i|
|
|
|
|
|
byte = arduino_port.read;
|
|
|
|
|
if(byte==13, {
|
|
|
|
|
(str).postln;
|
|
|
|
|
str = "";
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
str= str++byte.asAscii;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}).play;
|
|
|
|
|
}, {});
|
|
|
|
|
if(~arduino == 1, { arduino_port = SerialPort("/dev/ttyACM0", 115200)}, {});
|
|
|
|
|
|
|
|
|
|
// Get control signals from SynthDef
|
|
|
|
|
osc_func = OSCFunc.new({arg msg, time; brightness[msg[2]] = msg[3]; },'/tr', s.addr);
|
|
|
|
@ -78,16 +64,10 @@ refresh_func = { while { true } {
|
|
|
|
|
{|i| var minBrightness = 0.15, maxBrightness = 0.85;
|
|
|
|
|
arduino_port.put(i);
|
|
|
|
|
arduino_port.put(253);
|
|
|
|
|
//if(brightness[0] < 0
|
|
|
|
|
arduino_port.put(((((brightness[i] * (maxBrightness - minBrightness)) + minBrightness) - 1).abs * 256).asInteger);
|
|
|
|
|
arduino_port.put(254);
|
|
|
|
|
//arduino_port.put(254);
|
|
|
|
|
} ! 18 }, {});
|
|
|
|
|
|
|
|
|
|
// delay
|
|
|
|
|
30.reciprocal.wait; } };
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
//Char.space.asInt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|