SuperCollider: Light Dependent Resistor
This example shows how a single sensor can be streamed via serial data from the Arduino to SuperCollider.
Breadboard Circuit
The breadboard circuit is the same as in the first Arduino sensor example:
Arduino Code
For the SC example, serial data is sent in a simple way. The additional scaling is optional, but makes it easier to process the data in SuperCollider.
SC Code
On Linux, the Arduino's serial interface can be found in the terminal:
On the SC receiver end, a serial port object is initialized with the matching serial interface:
A control rate bus is used to visualize the received data and make it accessible to other nodes:
The actual receiving and decoding of the data happens inside a routine with an infinite loop. It appends incoming characters, until a return character (13) is received. In this case, the assembled string is converted to a Float and written to the sensor bus:
External Resources
The SuperCollider Tutorial by Eli Fieldsteel shows a similar solution for getting Arduino sensors into SuperCollider via USB.