Project 1- Alex

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