[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] arduino, sensors and how to get values out of SMS



Hello again list and happy holidays
I bought a Ping ultrasonic range finder and i'm using it with arduino. I managed to use it with SMS thanks to previous emails i found in the list, however i do not know how to take values OUT of SMS. From the older emails it was proposed to do something like this:



SynthDef("arduinosynthtest", { |freq|
        Out.ar([0,1], SinOsc.ar(freq, 0, 0.5));
}).send(s);


x = Synth(\arduinosynthtest);
p = ArduinoSMS("/dev/tty.usbserial-A6006jTe", 115200);
p.action = { |value| x.set(\freq, 400+value); value.postln;};          //the distance is sent from the arduino and it modulates the pitch of the SinOsc




However i m looking for something more flexible and wanted to make a function, say z= { | in | } to store temporarily the values from Ping, and then   p.action = "" style="color: rgb(0, 0, 191); ">|value| z.set(in, value); value.postln;}; but it doesnt work. 
Any help/propasals on how to do it apart from using a synthDef?

thanks,
Giannis