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

Re: [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 = { |value| z.set(in, value); value.postln;}; but it doesnt work.
Any help/propasals on how to do it apart from using a synthDef?

one way to do this, if you need to keep temporary values, is to create a routine:


p.action = Routine { |value|
	var outval, list;
	loop {
list = list.add(value); // eg. add them to an evergrowing list..
		x.set(\freq, 400+value);
		value.postln;
		value = outval.yield;
	}

};
--





.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/