Tom Igoe Fall 2015

Class Times

Wednesday, 9:00 AM – 11:30 AM
Wednesday 3:20 PM – 6:15PM

Contact:

tom.igoe@nyu.edu
Tom’s Calendar click here for office hours and to know my general schedule for the week.

Class Date Exceptions

I will be here for all classes, though I will be out of town some weekends, which will mean I have to move some office hours around. My  calendar page will always have the most up-to-date office hours.

 Useful links

A Few Good Reads

These are not on the main reading list, but I think they’re excellent reads if you’re thinking about physical interface design.

Class List

Class Blogs

Email me with direct links to your documentation for this class. Note: please set up tags, categories, or whatever so the link goes directly to the documentation specifically for this class, and not every class, or your life blog, etc.

Wednesday Morning Section

Wednesday Afternoon section

Code from week 4

long lastBlinkTime = 0;    // a variable to hold  your timestamp
int ledState = LOW;        // state of the LED

void setup() {
pinMode(8, OUTPUT);       // make pin 8 an output
Serial.begin(9600);       // initialize serial communications
}

void loop() {
  // this part of the loop happens as fast as the loop can run:
  // read the analog input:
  int sensor = analogRead(A0);
  // map its output to a 20 - 20000 range:
  int pitch = map(sensor, 0, 1023, 20, 20000);
  // make a tone on pin 10:
  tone(10, pitch);
  // print out the sensor value:
  Serial.println(sensor);

  // this part of the loop happens once every half second
  // because the if statement is only true every half second:
  if (millis() - lastBlinkTime >= 500) {
      ledState = !ledState;      // change 1 to 0, or  0 to 1
      digitalWrite(8, ledState); // set the LED
   lastBlinkTime = millis();     // take a timestamp
}

   // if you comment out the if statement and replace it with
   // the lines below, you'll see how delay() affects the interaction
   // between the knob and the pitch of the speaker:
   // digitalWrite(8, HIGH);
   // delay(500);
   // digitalWrite(8, LOW);
   // delay(500);
}

Code from week 7

/*
 Reads three ASCII-encoded numeric strings, separated by
 any non-numeric characters,and prints them back to the
 serial monitor.

 ideal input string: xx, yy, zz\n

 where xx, yy, and zz are numeric strings.
 */

void setup() {
 Serial.begin(9600); // initialize serial communication
 Serial.setTimeout(10); // set a 10ms timeout for waiting for the strings
}

void loop() {
 if (Serial.available() > 4) { // wait for at least 5 bytes
 int red = Serial.parseInt(); // read the first numeric string and parse
 int green = Serial.parseInt(); // read and parse the second string
 int blue = Serial.parseInt(); // read and parse the third string
 Serial.print("red: "); // print the word red
 Serial.print(red); // print the value of the first string
 Serial.print(" green: "); // print the word green
 Serial.print(green); // print the value of the second string
 Serial.print(" blue: "); // print the word blue
 Serial.println(green); // print the value of the third string
 }
}