[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] arduino
>
> Ah, it's like a responder on the SC side?
> Could you post a more verbose example?
>
An example for a potentiometer (variable resistor) would look like:
// Arduino:
#include <SimpleMessageSystem.h>
int val1 = 0;
void setup() { Serial.begin(9600); }
void loop()
{
val1 = analogRead(0);
messageSendInt(val1); // repeat for more sensor values
messageEnd();
delay(50);
}
//SuperCollider:
p = ArduinoSMS("/dev/ttyUSB0", 9600); // matches 9600 in setup() above
(
p.action = { |... msg|
// msg.postln;
~a1 = msg[0] / 1024; (convert 0..1024 to 0..1)
TempoClock.default.tempo = ~a1 * 2 + 1;
};
)
p.close;
_______________________________________________
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/