(edit sidebar)
Intro to Physical Computing Syllabus

Research & Learning

Other Class pages

Shop Admin

ITP Help Pages
Tom's pcomp site
DanO's pcomp site


Week 11

Intro.Week11 History

Hide minor edits - Show changes to output

Changed line 1 from:
[@
to:
(:source lang=arduino tabwidth=4 :)
Changed lines 20-21 from:
@]
to:
(:sourceend:)
Changed lines 1-2 from:

[
[@
to:
[@
Changed lines 20-21 from:
@]]
to:
@]
Added lines 1-22:

[[@
void loop() {
  // read sensors
  // if I get a peak on a sensor, make the light get bright
  // if there's no peak, fade the light until it's out

  while (brightness > 0) {
    analogWrite(pinNumber, brightness);
    brightness--;

    while (millis() - then < delayTime) {
      // wait
      sensorReading = analogRead(A0);
      if (sensorReading /4 > brightness) { 
        brightness = sensorReading /4;
      }
    }
  }
}
@]]

  Edit | View | History | Print | Recent Changes | Search Page last modified on November 21, 2012, at 05:11 PM