Thursday, February 28, 2013

Project 1


Here is what I presented in class for Project 1:



I am quite fascinated by time. I love that there are so many different perspectives on time. It is mysterious and can be the center of so many different trains of thought. A physicist might study the rules of time and how it works, whereas a physchologist will ask, "How do humans view time? How does it affect our actions?" and a philosopher will ponder interesting puzzles such as "Does time exist if nothing is changing?"

So I made a timer with my Arduino for this assignment.


 The question then is what should I do with this timer and I came up with the following theoretical art piece. The piece that I propose was inspired by this robot that I found a video of online. He was built with full spacial awareness, but as soon as he begins to go out and explore his environment he unplugs himself. He is just a robot, he does not have feelings or care, but still I feel sorry for him. I love the irony of this idea of frustrating a machine. A machine cannot feel frustration or anything else but the viewer tends to feel the emotion for the machine anyway.


A brief explanation of my proposed art piece. I am furthermore, very intrigued ad inspired by the additional irony of the idea of a useless superpower. The idea that one could possess or be granted an ability that is special, unique, or defies physics or normal human capability, but can achieve nothing with it.


For the more practically minded, you could use the timer I created in a number of ways, but thought of its potential use in pilates class to help me monitor my breathing and keep a steady slow pace, both of which are very important to doing pilates correctly.


Here is a schematic for my circuit board (These are the exact pin numbers that I used)



And here is my code from the project:



int Switch = 2;
int Pot = 5;
int R = 10;
int G = 8;
int B = 9;
int pot_val = 0;
int switch_val = 0;
int prev_switch_val = 0;
boolean go = 1;
boolean blink = 1;

double total_time = 100000.0;
double time_left = total_time;

// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pin as an output.
  pinMode(Pot, INPUT);
  pinMode(Switch, INPUT);
  pinMode(R, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(B, OUTPUT);

 Serial.begin(9600);
}

/*
**This function will wait the specified amount of time (relative, not in any specific metric)
**but still listens for the button press.
**Returns true immediately if button is pressed
**Otherwise returns false
*/
boolean wait(int time_out)
{
  while(time_out>0)
  {
    time_out--;
   
    prev_switch_val = switch_val;
    switch_val = digitalRead(Switch);
    if(switch_val==1 && prev_switch_val==0)
    {
      //time paused
      go = !go;
      return true;
    }
   
    //delay(1);
    delayMicroseconds(100);
  }
  return false;
}

void loop() {
  //Check and see if out time is up
  if(time_left <= 0)
  {
    Serial.println("Time's Up!");
    //Start things over (This would start the video over too)
    time_left = total_time;
    delay(1000);
  }
 
  //this part is basically waiting for a button press to unpause
  prev_switch_val = switch_val;
  switch_val = digitalRead(Switch);
  if(switch_val==1 && prev_switch_val==0)
  {
    //button was pressed, so we want to pause time
    go = !go; //boolean to pause the "time" and unpause on next press
  }
 
  //change the color of the light as time "runs out"
  //blinking according to the speed of "time"
  //but we make sure that the light is on when paused
  if(go)
  {
    pot_val = analogRead(Pot);    // read the pull down and print the value
    //This will control the speed of the blinking of the light
    //and the light should change from green to red faster
 
    //As long as this is not paused count down time
    //larger pot # = slower blink = slower time = less time elapsed
    double time_elapsed = map(pot_val,0,1023, 1000,100);
    time_left = time_left - time_elapsed;
 
    //light should be on
    if(blink){
        //change the color of the light slowly
       double c = (time_left) * (1 - .45) / (total_time)+.45;
       //red light overpowers at about c=.4 or .3 so altering this
       analogWrite(G,(c)*255);
       analogWrite(R,(1-c)*255);
       analogWrite(B,0);
     
       //wait the appropriate amount of time
       double wait_time = map(pot_val,0,1023,2000,5000);
       Serial.print(time_left);Serial.print(" ");
       Serial.print(wait_time);Serial.print(" ");
       Serial.println(c);
       wait(wait_time);
     
       //flip the blink boolean off
       blink = !blink;
    }
    else
    {
      //light is off
       analogWrite(G,0);
       analogWrite(R,0);
       analogWrite(B,0);
       //wait for proper duration
       double wait_time = map(pot_val,0,1023,2000,5000);
       wait(wait_time);
       //flip the blink boolean back on
       blink = !blink;
    }
  }
 else
  {
    //time is paused
    //make sure the light is on but doesnt blink or change color
    double c = (time_left) * (1 - .45) / (total_time)+.45;
    analogWrite(G,(c)*255);
    analogWrite(R,(1-c)*255);
    analogWrite(B,0);
   
    Serial.println("Paused");
  }
}

No comments:

Post a Comment