I like taking digital mediums and making them more accessible for untrained artists. I think that everyone should be able to mess around with computers and make cool stuff. For this project, I decided to make a physical interface for the media lab control patch Jesse gave us.
insert photo of the arduino I forgot to take here
Arduino control code
// constants won’t change. They’re used here to set pin numbers:
const int buttonOnePin = 3; // the number of the redlight pushbutton pin
const int ledOnePin = 9; // the number of the LED pin
const int buttonTwoPin = 4; // the number of the yellowlight pushbutton pin
const int ledTwoPin = 10; // the number of the LED pin
const int buttonThreePin = 5; // the number of the bluelight pushbutton pin
const int ledThreePin = 8; // the number of the LED pin
// variable buttons
int buttonOneState = 0; // variable for reading the pushbutton status
int buttonTwoState = 0;
int buttonThreeState = 0;
//variables knob
const int potPin = 3; // select the input pin for the potentiometer
int potVal = 0; // variable to store the value coming from the sensor
int mappedPotVal = 0;
//variables slider
const int slidePin = 0;
int slideVal = 0;
int mappedSlideVal = 0;
//variables for ir detector
const int irPin = 5;
int irVal = 0;
int mappedIrVal = 0;
//joystick
const int swPin = 2; // digital pin connected to switch output
const int xPin = 2; // analog pin connected to X output
const int yPin = 1; // analog pin connected to Y output
int xState = 0;
int yState = 0;
int mappedXState = 0;
int mappedYState = 0;
void setup() {
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(ledOnePin, OUTPUT);
pinMode(ledTwoPin, OUTPUT);
pinMode(ledThreePin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonOnePin, INPUT);
pinMode(buttonTwoPin, INPUT);
pinMode(buttonThreePin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonOneState = digitalRead(buttonOnePin);
buttonTwoState = digitalRead(buttonTwoPin);
buttonThreeState = digitalRead(buttonThreePin);
// check if the redlight pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonOneState == HIGH) {
// turn LED on:
digitalWrite(ledOnePin, HIGH);
} else {
// turn LED off:
digitalWrite(ledOnePin, LOW);
}
// check if the yellowlight pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonTwoState == HIGH) {
// turn LED on:
digitalWrite(ledTwoPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledTwoPin, LOW);
}
// check if the bluelight pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonThreeState == HIGH) {
// turn LED on:
digitalWrite(ledThreePin, HIGH);
} else {
// turn LED off:
digitalWrite(ledThreePin, LOW);
}
//check the turn potentiometer values, map them to the bay range
potVal = analogRead(potPin); // read the value from the potentiometer
mappedPotVal = map(potVal, 0, 1023, 1, 9);
//check the slide potentiometer values, map them to the saturation range
slideVal = analogRead(slidePin);
mappedSlideVal = map(slideVal, 0, 1023, 0, 255);
//check switch
xState = analogRead(xPin);
yState = analogRead(yPin);
mappedXState = map(xState, 0, 1023, 0, 255);
mappedYState = map(yState, 0, 1023, 0, 255);
//check the ir values
irVal = analogRead(irPin);
mappedIrVal = map(irVal, 0, 550, 0, 8);
Serial.print(buttonOneState);
Serial.print(” “);
Serial.print(buttonTwoState);
Serial.print(” “);
Serial.print(buttonThreeState);
Serial.print(” “);
Serial.print(mappedPotVal);
Serial.print(” “);
Serial.print(mappedSlideVal);
Serial.print(” “);
Serial.print(mappedXState);
Serial.print(” “);
Serial.print(mappedYState);
Serial.print(” “);
Serial.println(mappedIrVal);
delay(50);
}
Control patch
bpatcher edits
video of working is too big sorry
heres the gist
<pre><code> | |
----------begin_max5_patcher---------- | |
3562.3oc4cszbiaiD97jpx+AV9ztU4nBuAXtkZOkC6o83toRQaywlSjD8RQM | |
YbRs+2W7fjhxxDngMDsnilJVwPxhe8G5tQitaP8me+28oqto9ak6tJ6Gy92Y | |
e5S+odjOYGyLxm5G3SWso3a2ttXm8Md0s0a1Tts8pq6dw1xu0ZegaxL+qIKa | |
Wl4w2L+3I8+U0L7d2teS010ks1OIb+nU2Y+6qu4K+P9va8wh1aenZ68+ZS4s | |
sNDRwqPWmwDLySXI07DQ+yreYzme8919K.pe3csOstzdMF93+b811cU+gcTr | |
9CzN7+66+Nyy5mtFLcrs720.+T1XWVScaQySZHAW7o9DeQN0I3DySRKKPH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Nr4BxBl7aTf1hjsRuuZ8RulnTs6rtqGms+VxvY3L75uyHE4jU4DkFoN | |
jY25OsGm7jgyfEpgDXOKR4JBloC4b.mr98.jRbFNSEg1exvjrsVRpzCQQPHF | |
P0jyWIMy3rAbdTxsRKZoAsbC0UzpUBlQCc.sc6HIs3jGDmAJIq49VklSI4GX | |
0wqAlVzJCu1l+tTPJ6zSc15DFdXez1wNAoc20bJd7wuV1rq6h4.4UaJ9Rsam | |
eW698pste2cGK6plxuV0+mvbCUzb6CUsk21tuwcW54ahtasnWsoVGJv18U8w | |
jYwf9G+e.HxPBhB | |
-----------end_max5_patcher----------- | |
</code></pre> |