rhoadley.net music research software blogs
aru seminars m&t critski focm1a cmc circuit bending mic2b sensor technology comp 3 sonic art major project
youtube vimeo facebook
Resources: Bioacoustics Jitter MaxMSP OSC Physical PD CBHH sTech SuperCollider C/Xcode
sTech Resources: Home Blog Forum Examples Projects Tasks Tutorials
| Task 8 | Name: Triggering and modulating events | Set: w5i | Due: Monday 19th December 2016 | Weighting: assessable (10%) | Courses: stech |
| Prev Task: Investigating sensors - Make your own sensor - Make your own arduino | Next Task: Advanced sensors | ||||
| Task Summary | All sTech tasks | ||||
A brief tutorial concerning writing to the arduino.
Save the following files as...
int ledPina = 11;
int ledPinb = 10;
int ledPinc = 9;
int vala;
int valb;
int valc;
int nextval = 1;
void setup()
{
// begin the serial communication
Serial.begin(115200);
pinMode(ledPina, OUTPUT);
pinMode(ledPinb, OUTPUT);
pinMode(ledPinc, OUTPUT);
}
void loop()
{
if (Serial.available()) {
if(nextval == 1) {
vala = Serial.read();
analogWrite(ledPina, vala);
nextval = 2;
}
}
if (Serial.available()) {
if(nextval == 2) {
valb = Serial.read();
analogWrite(ledPinb, valb);
nextval = 3;
}
}
if (Serial.available()) {
if(nextval == 3) {
valc = Serial.read();
analogWrite(ledPinc, valc);
nextval = 1;
}
}
}
|
You might also be interested in: