November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


Project Members: 
Kathleen Lu



Use the Arduino to control a light emitting diode and make it blink.

Components Used

Light Emitting Diode (LED)--blue, red

Arduino Code

/* I said "Freeze!"
 * I added a FSR into Paddington so that when he raises his arm to
 * in hot pursuit of a thief, it will emit a whistle (like the
   British bobbies */
int speakerPin = 7;
int ledPin1 = 13;  // blue LED
int ledPin2 = 12;  // red LED
int fsrPin = 0;

int fsrVal=0;  //store value read from FSR
int tone = 956; //The "whistle" is in C

void setup()
  pinMode(ledPin1, OUTPUT);      // sets the digital pin as output for blue LED
  pinMode(ledPin2, OUTPUT);      // sets the digital pin as output for blue LED
  pinMode(speakerPin, OUTPUT);

void loop()
  //load the value from the FSR
  fsrVal = analogRead(fsrPin);  // read the value from the FSR; 0 = arm up; > 0 = arm down
  Serial.print("fsrVal ");      // debug--what's the FSR reading?
  if (fsrVal > 0) 
  // if Paddington's arm is down, he's not in pursuit
  digitalWrite(ledPin1, HIGH);   // sets the blue LED on
  digitalWrite(ledPin2,LOW);    //sets the red LED off
  delay(1000);                  // waits for a second
 // if Paddington's in hot pursuit and waving his arm menacingly
 // have the LED blink violently as if he's trying to pull-over a car

//beep once and blink the LED
void inPursuit()
  digitalWrite(ledPin1, LOW);  // sets the blue LED on
  digitalWrite(ledPin2, HIGH);  //sets the red LED off
    delay(100);                 // make the red light blink rapidly
  for( int i=0; i<50; i++ )
    digitalWrite(speakerPin, HIGH);
    digitalWrite(speakerPin, LOW);
  digitalWrite(ledPin2, LOW);  //sets the red LED off
Paddington on PatrolFreeze! (Paddington in hot pursuit of fleeing suspect)

Paddington on Patrol (blue LED on)

Freeze! (Paddington in hot pursuit of fleeing suspect--red LED on and beep)

Powered by Drupal - Design by Artinet