serialRead Serial I/O serialRead serialRead Read data from a serial port. Description Plugin opcode in serial. Read data from a serial port for arduino. Syntax kByte serialRead iPort Performance iPort -- port number optained from a serialBegin opcode. kByte -- a byte of data to read. Examples Here is an example of the serialRead opcode. It uses the file serialRead.csd. Example of the serialRead opcode. See the sections Real-time Audio and Command Line Flags for more information on using command line flags. This is the matching Arduino code : void setup() { // enable serial communication Serial.begin(9600); // declare pin 9 to be an output: pinMode(9, OUTPUT); } void loop() { // only do something if we received something (this should be at csound's k-rate) if (Serial.available()) { // set the brightness of LED (connected to pin 9) to our input value int brightness = Serial.read(); analogWrite(9, brightness); // while we are here, get our knob value and send it to csound int sensorValue = analogRead(A0); Serial.write(sensorValue/4); // scale to 1-byte range (0-255) } } ..... See Also non-MIDI Devices Credits Author: &namematt; 2011 New in version 5.14