Brady Williams PC

From BenningtonWiki
Jump to: navigation, search

Fine Art of Physical Computing, Spring 2014

Class wiki
Class website
Brady Williams PC Final


Assignments

Week 2

Photos

Example 01

// Example 01 : Blinking LED
const int LED = 13; // LED connected to
                    // digital pin 13
void setup()
{
  pinMode(LED, OUTPUT);
void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
// sets the digital
// pin as output
  // turns the LED on
  // waits for a second
  // turns the LED off
  // waits for a second
}
}

Example 02

// Example 02: Turn on LED while the button is pressed
const int LED = 13;   // the pin for the LED
const int BUTTON = 7; // the input pin where the
                      // pushbutton is connected
int val = 0;          // val will be used to store the state
                      // of the input pin
void setup() {
  pinMode(LED, OUTPUT);   // tell Arduino LED is an output
  pinMode(BUTTON, INPUT); // and BUTTON is an input
}
void loop(){
  val = digitalRead(BUTTON); // read input value and store it
  // check whether the input is HIGH (button pressed)
  if (val == HIGH) {
    digitalWrite(LED, HIGH); // turn LED ON
  } else {
    digitalWrite(LED, LOW);
  }
}

Example 03A

// Example 03A: Turn on LED when the button is pressed
// and keep it on after it is released
const int LED = 13;   // the pin for the LED
const int BUTTON = 7; // the input pin where the
                      // pushbutton is connected
int val = 0;    // val will be used to store the state
                // of the input pin
int state = 0;  // 0 = LED off while 1 = LED on
void setup() {
  pinMode(LED, OUTPUT);   // tell Arduino LED is an output
  pinMode(BUTTON, INPUT); // and BUTTON is an input
}
void loop() {
  val = digitalRead(BUTTON); // read input value and store it
  // check if the input is HIGH (button pressed)
  // and change the state
  if (val == HIGH) {
    state = 1 - state;
  }
  if (state == 1) {
    digitalWrite(LED, HIGH); // turn LED ON
  } else {
    digitalWrite(LED, LOW);
} }

Example 03B

// Example 03B: Turn on LED when the button is pressed
// and keep it on after it is released
// Now with a new and improved formula!
const int LED = 13;   // the pin for the LED
const int BUTTON = 7; // the input pin where the
                      // pushbutton is connected
int val = 0;     // val will be used to store the state
                 // of the input pin
int old_val = 0; // this variable stores the previous
                 // value of "val"
int state = 0;   // 0 = LED off and 1 = LED on
void setup() {
  pinMode(LED, OUTPUT);    // tell Arduino LED is an output
  pinMode(BUTTON, INPUT);  // and BUTTON is an input
}
void loop(){
  val = digitalRead(BUTTON); // read input value and store it
                             // yum, fresh
  // check if there was a transition
  if ((val == HIGH) && (old_val == LOW)){
    state = 1 - state;
  }
  old_val = val;  // val is now old, let's store it
  if (state == 1) {
    digitalWrite(LED, HIGH); // turn LED ON
  } else {
    digitalWrite(LED, LOW);
} }

Example 03C

// Example 03C: Turn on LED when the button is pressed
// and keep it on after it is released
// including simple de-bouncing
// Now with another new and improved formula!!
const int LED = 13;    // the pin for the LED
const int BUTTON = 7;  // the input pin where the
// pushbutton is connected
int val = 0;     // val will be used to store the state
// of the input pin
int old_val = 0; // this variable stores the previous
// value of "val"
int state = 0;   // 0 = LED off and 1 = LED on
void setup() {
  pinMode(LED, OUTPUT);   // tell Arduino LED is an output
  pinMode(BUTTON, INPUT); // and BUTTON is an input
}
void loop(){
  val = digitalRead(BUTTON); // read input value and store it
  // yum, fresh
  // check if there was a transition
  if ((val == HIGH) && (old_val == LOW)){
    state = 1 - state;
    delay(10); 
  }
  old_val = val; // val is now old, let's store it
  if (state == 1) {
    digitalWrite(LED, HIGH); // turn LED ON
  } 
  else {
    digitalWrite(LED, LOW);
  } 
}

Week 3

Photos

LED Fade

// Example 04: Fade an LED in and out like on
// a sleeping Apple computer
const int LED = 9; // the pin for the LED
int i = 0;         // We’ll use this to count up and down
void setup() {
  pinMode(LED, OUTPUT); // tell Arduino LED is an output
}
void loop(){
  for (i = 0; i < 255; i++) { // loop from 0 to 254 (fade in)
    analogWrite(LED, i);      // set the LED brightness
    delay(10); // Wait 10ms because analogWrite
               // is instantaneous and we would
               // not see any change
  }
  for (i = 255; i > 0; i--) { // loop from 255 to 1 (fade out)
    analogWrite(LED, i); // set the LED brightness
    delay(10);           // Wait 10ms
  }
}

Analog Blink

// Example 06B: Set the brightness of LED to
// a brightness specified by the
// value of the analogue input
const int LED = 9;  // the pin for the LED
int val = 0;   // variable used to store the value
               // coming from the sensor
void setup() {
  pinMode(LED, OUTPUT); // LED is as an OUTPUT
  // Note: Analogue pins are
  // automatically set as inputs
}
void loop() {
  val = analogRead(0); // read the value from
                       // the sensor
  analogWrite(LED, val/4); // turn the LED on at
                           // the brightness set
                           // by the sensor
  delay(10); // stop the program for
             // some time
}

Button Fade LED

//  Example 05: Turn on LED when the button is pressed
//  and keep it on after it is released
//  including simple de-bouncing.
//  If the button is held, brightness changes.
const int LED = 9;     // the pin for the LED
const int BUTTON = 7;  // input pin of the pushbutton
int val = 0;     // stores the state of the input pin
int old_val = 0; // stores the previous value of "val"
int state = 0;   // 0 = LED off while 1 = LED on
int brightness = 128;        // Stores the brightness value
unsigned long startTime = 0; // when did we begin pressing?
void setup() {
  pinMode(LED, OUTPUT);   // tell Arduino LED is an output
  pinMode(BUTTON, INPUT); // and BUTTON is an input
}
void loop() {
  val = digitalRead(BUTTON); // read input value and store it
                             // yum, fresh
  // check if there was a transition
  if ((val == HIGH) && (old_val == LOW)) {
    state = 1 - state; // change the state from off to on
                       // or vice-versa
    startTime = millis(); // millis() is the Arduino clock
                          // it returns how many milliseconds
                          // have passed since the board has
                          // been reset.
    // (this line remembers when the button
    // was last pressed)
    delay(10);
}
// check whether the button is being held down
  if ((val == HIGH) && (old_val == HIGH)) {
    // If the button is held for more than 500ms.
    if (state == 1 && (millis() - startTime) > 500) {
      brightness++; // increment brightness by 1
      delay(10);    // delay to avoid brightness going
                    // up too fast
      if (brightness > 255) { // 255 is the max brightness
        brightness = 0; // if we go over 255
                        // let’s go back to 0
} }
}
  old_val = val; // val is now old, let’s store it
  if (state == 1) {
    analogWrite(LED, brightness); // turn LED ON at the
                                  // current brightness level
  } else {
    analogWrite(LED, 0); // turn LED OFF
} }

Fade LED from Potentiometer

// Example 06A: Blink LED at a rate specified by the
// value of the analogue input
const int LED = 13; // the pin for the LED
int val = 0;   // variable used to store the value
               // coming from the sensor
void setup() {
  pinMode(LED, OUTPUT); // LED is as an OUTPUT
  // Note: Analogue pins are
  // automatically set as inputs
}
void loop() {
  val = analogRead(0); // read the value from
                       // the sensor
  digitalWrite(LED, HIGH); // turn the LED on
  delay(val); // stop the program for
              // some time
  digitalWrite(LED, LOW); // turn the LED off
  delay(val); // stop the program for
              // some time
}

Analog Fade LED

// Example 06B: Set the brightness of LED to
// a brightness specified by the
// value of the analogue input
const int LED = 9;  // the pin for the LED
int val = 0;   // variable used to store the value
               // coming from the sensor
void setup() {
  pinMode(LED, OUTPUT); // LED is as an OUTPUT
  // Note: Analogue pins are
  // automatically set as inputs
}
void loop() {
  val = analogRead(0); // read the value from
                       // the sensor
  analogWrite(LED, val/4); // turn the LED on at
                           // the brightness set
                           // by the sensor
  delay(10); // stop the program for
             // some time
}

Serial Test

// Example 07: Send to the computer the values read from
// analogue input 0
// Make sure you click on "Serial Monitor"
// after you upload
const int SENSOR = 0;  // select the input pin for the
                       // sensor resistor
int val = 0; // variable to store the value coming
             // from the sensor
void setup() {
 Serial.begin(9600); // open the serial port to send
                     // data back to the computer at
                     // 9600 bits per second
}
void loop() {
  val = analogRead(SENSOR); // read the value from
                            // the sensor
  Serial.println(val); // print the value to
                       // the serial port
  delay(100); // wait 100ms between
              // each send
}

Week 4

Photos

Sweep Code

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(2);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
}

Knob Code

#include <Servo.h>      // include the servo library

Servo servoMotor;       // creates an instance of the servo object to control a servo
int servoPin = 2;       // Control pin for servo motor


void setup() { 
  Serial.begin(9600);       // initialize serial communications
  servoMotor.attach(servoPin);  // attaches the servo on pin 2 to the servo object
} 

void loop() 
{ 
  int analogValue = analogRead(A0); // read the analog input 
  Serial.println(analogValue);      // print it

  // if your sensor's range is less than 0 to 1023, you'll need to
  // modify the map() function to use the values you discovered:
  int servoAngle = map(analogValue, 0, 1023, 4, 179);//below four the servo was weird and vibratey, like it was bouncing up against it's hard stop.

  // move the servo using the angle from the sensor:
  servoMotor.write(servoAngle);                  
}

Week 7


Arduino Code


void setup() {
    Serial.begin(9600);
}
void loop() {
    int analogValue = analogRead(A0)/4;      // read the pot value
    Serial.write(analogValue);        // print the value in the serial monitor as a binary value
}

Processing Code

import processing.serial.*;

Serial myPort;        // The serial port
float xPos = 0;             // horizontal position of the graph

void setup () {
  size(800, 600);        // window size
    println(Serial.list());

  println(Serial.list()[9]);

String portName = Serial.list()[9];
myPort = new Serial(this, portName, 9600);
 background(#081640);

}

void draw () {
  // nothing happens in draw.  It all happens in SerialEvent()
}

void serialEvent (Serial myPort) {
  // get the byte:
  int inByte = myPort.read(); 
  // print it:
  println(inByte);
  float yPos = height - inByte;
// draw the line in a pretty color:
stroke(#A8D9A7);
line(xPos, height, xPos, height - inByte);
// at the edge of the screen, go back to the beginning:
  if (xPos >= width) {
    xPos = 0;
    // clear the screen by resetting the background:
    background(#081640); 
  } 
  else {
    // increment the horizontal position for the next reading:
    xPos++;
  }
}

Backwards Graph Experiment

import processing.serial.*;

Serial myPort;        // The serial port
float xPos = 800;             // horizontal position of the graph
int div=0;

void setup () {
  size(800, 600);        // window size
    println(Serial.list());

  println(Serial.list()[9]);

String portName = Serial.list()[9];
myPort = new Serial(this, portName, 9600);
 background(#081640);

}

void draw () {
  // nothing happens in draw.  It all happens in SerialEvent()
}

void serialEvent (Serial myPort) {
  // get the byte:
  int inByte = myPort.read(); 
  // print it:
  println(inByte);
  float yPos = height - inByte;
// draw the line in a pretty color:
stroke(#A8D9A7);
div =2;
line(xPos, height/div + inByte, xPos, height/div - inByte);
// at the edge of the screen, go back to the beginning:
  if (xPos <= 0) {
    xPos = 800;
    // clear the screen by resetting the background:
    background(#081640); 
  } 
  else {
    // increment the horizontal position for the next reading:
    xPos-=.10;
  }
}

Week 8

See Robin_Hrynyszyn_PC#Week_8.


Cool Stuff

Grafiti By Drone.

Readings

Week 1

The Art of Interactive Design

I found this reading to be very on point for myself, as I did the reading after my first protection class. In the class I was particularly drawn to the more interactive projection designs especially relating to the dance productions. It was very helpful to read a definition of what interactivity to designers even if it is centered around a different discipline. I thought his defining of interaction is the cyclic whole process and basing it around the concept of a conversation was a very relatable and apt comparison. It was also interesting to see him break down the important parts of conversation your think about it when you have a conversation but talking listening and thinking are the critical aspects of any conversation. I also like his comments on interactivity is being variable scale, and that interactivity is not a higher form of reactivity but a separate concepts altogether. His separation of Interactivity design, Human Factor design and user-interface design was helpful. I think the thing I like most about this meeting is is attitude, which is very unconventional for a textbook, this was especially noticeable in his review questions. I don't agree with all of his arguments for why interactivity is important in the computer age, I question his minimization of the importance of graphics, audio, video etc. It was really interesting for him to identify a spreadsheet program as the pinnacle of interactivity or at least the critical tipping point of interactivity it seems like such a boring and uninspiring program and at first glance it is, but when you really understand how to use it, it becomes clear how critical the instant feedback is.

Week 3

"The Design of Everyday Things"

This reading was fascinating, throughout the entire piece I couldn't stop thinking of the design decisions that went into the iPhone, and how it solves each problem more elegantly than most others. The datedness of this piece is apparent in this regard–the major point he gets across is that when you start mapping more functions to less physical inputs you have to be very purposeful, and very thoughtful, about how the user is going to use it; and when adding new features, weigh any increase in complexity against the increase in usability. I feel like this concern is less, but still rather relevant with the advent of touch screens which enable one to dynamically change both the visual cues, and the physical control surfaces. I was also interested in Norman's comments about the importance of iterating over a product multiple times to figure out how to do it correctly, and how nobody ever gets the product right the first time. I can't help but loop back to Apple in this thought–we regularly see this with their products, they have never been the first to market with any of their successful products, they saw the iterative designs of the marketplace, picked off the best aspects of each design, and then iterated in R&D repeatedly until they found what they thought was the best product possible, and have been incredibly successful on that front.

Week 4

"The User Illusion"

This was absolutely fascinating, As designers/artists/makers/creators it's always stressed that understanding your audience is important. But that is usually stressed in a much more high level, with a focus on knowing their tastes, knowing their backgrounds, and knowing their sensitivities, but knowing the biological restrictions on their perception of your thing is the most fundamental and critical way of knowing your audience. You can make an film that has super high resolution far above what currently exists, but it doesn't matter, and isn't worth the extra money if the audience is biologically restricted from being able to see the difference. This is also a very good reminder that often times, less is more. Most of the time, more just complicates and confuses, it adds complexity that then has to be stripped away for the conscious mind to process the idea. There is a lot of research going into this idea with regards to rendering high resolution videogames and other rendered content. The gradual shift from 1080p to 4k resolution standard puts an enormous burden on graphics cards and rendering engines, people are beginning to study what is being termed foveated rendering. Our eyes can only perceive high resolution in a relatively small area(about the size of your thumbnail at arms length), so people are researching the idea of tracking where ones looking, and then only rendering that specific area in high resolution, with a graceful degradation of resolution in the surrounding area. This would significantly cut down on the processing power required to play a given game, and provide more power for other critical functions. This is a great example of understanding the biological limits and shaping the technology to take maximum advantage of said shortcomings.


Final Project

Initial Concept

I'm interested in cooking and culinary arts, and particularly interested in making restaurant kitchens as efficient and low man power as possible. For the final, I'm interested in building a 'robot' that runs a grill/flattop station automatically. My first thoughts are that the machine will track the food on the griddle with an IR camera, detect the temperature of the meat with Non–Contact Thermometers, and control a spatula, or set of tongs with a 3d printing like arrangement of servos. Brady W PC 14 Final Sketch.jpg

Brady, I have seen a couple pancake makers around One from Make, Automatic pancake machine by ChefStack, A show on Discovery where a team made an automatic pancake maker Pancakes may be a bit more manageable than meat Rhrynyszyn 15:08, 15 April 2014 (UTC)


Sketches

Brady W PC 14 Final Sketch 2.jpg

In Class Poster

Brady W PC 14 Class Poster 1.jpg

Resources

Stepper Motor

Stepper Library

Arduino and Isadora Talking–Isadora will be tracking the items being cooked, and may be doing some of the processing.