The Ink Machine

int motors[] = {
10,9,8};
int vals[] = {
0,0,0};
int old_vals[] = {
0,0,0};
int states[] = {
0,0,0};

void setup() {
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
}

void loop(){
for(int i=0; i<3; i++){
vals[i] = analogRead(i);
if((vals[i] >= 500) && (old_vals[i] < 500)){
states[i] = 1-states[i];
delay(100);
}

old_vals[i] = vals[i];

if(states[i] == 1){
digitalWrite(motors[i],HIGH);
}
else{
digitalWrite(motors[i],LOW);
}
}
}

The code above was active inside the Arduino during the presentation; all of the motors used similar actions inside the for loop. In order to avoid the delay of executing individual functions, the values are set up in arrays; without this, one could not log an accurate time.

The idea of altering pitch to control the ink flow was experimented with, but the microphones had difficulty picking up any sounds without the use of an amplifier. Additionally, more values will be passed through the for loop using an array, containing different frequencies groups and expanding the project.

Other problems were delt with by adding a delay, to insure the correct value is used, as well as a state.. The state function toggles the motors on and off, to avoid fluctuationg values.

 

Back