## Week 2: Analog Input

### Image

Led brightness controlled by potentiometer

Unfortunately I cannot post a video here that would explain this lab much better than I can…

Basically, a potentiometer is hooked up to the arduino. The arduino reads in theanalog value of the potentiometer (twisting the pot changes it’s resistance which the comp can indirectly detect) and changes the led accordingly.

When the computer receives analog information about the potentiometer is converts that information into a digital language it can understand (namely a ten bit number: 0-1023) using the built in ADC (analog digital converter). When the computer tells the light to be brighter or dimmer it is doing so by pulsing the voltage from 0V to 5V (using PWM) at different rates (the percent of time spent at 0V or 5V can vary. Thus, the average voltage can vary as well anywhere in the 0-5V range). This pulsing can be seen using a camera but is not detected by the human eye.

The circuit is built like so:

and here is the code:

const int ledPin=9;
int potVal = 0;//initialize
int brightness = 0;
float voltage = 0;

void setup(){
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop(){
potVal = analogRead(A0);//between 0 & 1023 when mapped
//potVal = map(potVal, 0, 800, 0, 255);
brightness = potVal / 4; //divide by 4 because 0-255 is the full output range of analogWrite
analogWrite(ledPin, brightness);
voltage = (potVal/1023.0)*5.0;
Serial.print(potVal);
Serial.print(“\t”);
Serial.print(brightness);
Serial.print(“\t”);
Serial.println(voltage);

}

Note that the mapping is an alternative to creating the constant brightness and map values will depend on your particular LED.

## Fantasy Device

### Image

A device that I would dearly want and that is not completely out of reach is a simple to use 3D printer paired with a scanner…

To use it you would place an object you which to duplicate inside your device (imagine a stylish microwave) and your object would first be scanned. After the scan, you would be asked to customize your duplicate (scale, number of copies, colors, materials, etc.) and your duplicate would be ready a few minutes later…

With regards to the interface, something easy and functional would be best (think standard copy machine controls). What might be interesting however, would be if you could digitally “sculpt” something with your hands. You could reach inside your machine’s scanning unit and start recording the motions you make. The machine would interpret your movements and show you a 3D model representation of your hands modeling a block of clay in real time. Once you are satisfied with the result you could either print out a copy or open up a CAD file on your computer to tinker with the model further (in case precision is needed).

Quick sketch of device (using CAD then illustrator and a little imagination)

## Physical Computing: Week 1

### Image

Lab 4:

Digital Input and Output with an Arduino

Here’s the code for the light switch lab (pictured above):

Note: Constant (const) creation not necessary just nice to know what pins I’m using could come in handy later…

const unsigned int LED_BIT0 = 3;
const unsigned int LED_BIT1 = 4;
const unsigned int BUTTON_PIN = 2;

void setup(){
pinMode(LED_BIT0, OUTPUT);
pinMode(LED_BIT1, OUTPUT);
pinMode(BUTTON_PIN, INPUT);
}

void loop(){
digitalWrite(LED_BIT0, HIGH);
digitalWrite(LED_BIT1, LOW);
}
else{
digitalWrite(LED_BIT0, LOW);
digitalWrite(LED_BIT1, HIGH);
}
}

# Physical Computing: Week 1

Observing people interacting with technology:

• Announcement Board in subway: not interactive in Crawford’s definition but interesting nonetheless
• Subway Doors: system put in place to deal with people blocking the closing doors. Very much a New York thing
• Elevators: similar system but doors stop before they crush you… interesting
• Passed by Times Square: not a lot of interactivity but a ton of tech. If Times Square became interactive it would be even more overwhelming… Dangers of too much interactivity. Are our brains ready for this new era?
• tv’s in taxi cab: interactive? meant to be a dialogue of information with limited thinking on the part of the computer… For me it’s more like Crawford’s fridge door example: I get in and immediately turn the tv off with no other interactivity
• Reading a book: I think Crawford is wrong about this because he completely overlooks human psychology and the ability of humans to double. We are in fact having a conversation with oneself using the book as conversation stimulus. Nothing wrong with that with regards to Crawford’s definition of interactivity… At least not that I can think of.