rhoadley.net music research courses software blogs
ARU Seminars Comp&Imp NMP CMC2a CBHH
Sensor Technology Sonic Art Major Project MA Resources
Resources: Bioacoustics Jitter MaxMSP OSC Physical PD CBHH sTech SuperCollider C/Xcode
sTech Resources: Home Blog Forum Examples Projects Tasks Tutorials
| Task 3 | Name: Arduino, MaxMSP and SuperCollider | Set: w4i | Due: Thursday 16th December 2010 | Weighting: 10% | Courses: stech |
| Prev Task: Vibrating a Piezo | Next Task: Arduino, Sensors and Music | ||||
| Task Summary | All stech tasks | ||||
To cover:
Please see here for the latest versions of these patches, as well as other methods of communicating.
NB In order to use it you must install the Arduino quark. Evaluate the following to see if it's already there:
Quarks.gui;
If not, you should be able to install it with an internet connection and the following:
Quarks.update("arduino");
Quarks.install("arduino");
After installation you'll need to recompile the Library (command-k).
See the Quarks helpfile for more information.
/*
Analog input
reads an analog input on analog in 0, prints the value out.
created 24 March 2006
by Tom Igoe
*/
int analogValue = 0; // variable to hold the analog value
void setup() {
// open the serial port at 115200 bps:
Serial.begin(115200);
}
void loop() {
// read the analog input on pin 0:
analogValue = analogRead(0);
Serial.println(analogValue); // print as an ASCII-encoded decimal
// delay 10 milliseconds before the next reading:
delay(10);
}
// change the serial port identifier...
p = ArduinoSMS("/dev/tty.usbserial-A9007KNG", 115200);
p.action = { |... msg| msg.postln };
p.close; // close just the port you've just opened
SerialPort.closeAll; // close all ports.
Use the patch above.
Then you can read the results as an array in SC. In Max you should see two values on Analog ins 1 and 3 - the second value is the comma!
int analogValue0 = 0; // variable to hold the analog value
int analogValue1 = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
analogValue0 = analogRead(0);
analogValue1 = analogRead(1);
Serial.print(analogValue0);
Serial.print(", ");
Serial.println(analogValue1);
delay(10);
}
See the next task for this functionality.
If you attempted to use two controllers with one board it will have occurred to you that you don't really have enough holes. If this is the case, then you'll want to use a breadboard.
|
You might also be interested in:
The projects and tasks are designed to help you through the various courses and materials that you'll have to deal with, and also to provide an active and practical element to what could otherwise become a rather dry and technical exercise. Tasks are small exercises - you may be asked to complete one or two per week. Projects are larger and carry a higher percentage of the mark. We will undertake two, three, four or more projects and tasks. The final project is usually an individual choice project, and will be worth significantly more than the others in terms of percentages in your portfolio. We will usually try to set aside a time to perform the projects in a public setting.