Archive for January, 2009

Molmol and Gordie Break an Egg (with help from Evel and Elmo)

Thursday, January 29th, 2009

Here is the video of the Rube Goldberg egg-breaking device Molmol and I made for Dustyn Roberts’ Mechanisms and Things that Move class. It was great fun working with Molmol, who was responsible for figuring out how we would actually crack the egg. The project also gave me a chance to empty out my toy closet.

Enjoy the mad scramble!

Emily and Gordie do P Comp and make a Valentine Rat

Wednesday, January 28th, 2009

Here are the first assignments for P Comp:

LED Blink:


PCompBlink from Edward Gordon on Vimeo.

The code:

int ledPin = 13; //LED connected to pin 13

void setup() //run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); //sets the digital pin as output
}

void loop() //run over and over again
{
digitalWrite(ledPin, HIGH); //sets the LED on
delay(1000); //waits for a second
digitalWrite(ledPin, LOW); //sets the LED off
delay(3000); //waits for 3 seconds
}

The Switch:


PComp Switch from Edward Gordon on Vimeo.

Here is the code:

//declare variables:
int switchPin = 2; // digital input pin for a switch
int yellowLedPin = 3; // diagital output pin for a LED
int redLedPin = 4; // diagital output pin for a LED
int switchState = 0; // the state of the switch

void setup() {
pinMode(switchPin, INPUT); // set the switch pin to be an input
pinMode(yellowLedPin, OUTPUT); // set the yellow pin to be an output
pinMode(redLedPin, OUTPUT); // set the red pin to be an output
}

void loop() {
// read the switch input:
switchState = digitalRead(switchPin);

if (switchState == 1) {
// if the switch is closed:
digitalWrite (yellowLedPin, HIGH); // turn on the yellow LED
digitalWrite (redLedPin, LOW); // turn off the red LED
}
else {
// if the switch is open:
digitalWrite (yellowLedPin, LOW); // turn off the yellow LED
digitalWrite (redLedPin, HIGH); // turn on the red LED
}
}

Here’s the switch Emily and I worked on:



And working with Emily Ryan, we turned a simple squeak toy into a blazing-eyed Valentine Rat!

While working on the rat, I regaled those in the lab with us with the story of my experience in rat dissection in my freshman year biology lab class at Penn:

Here is a rat who found a better fate:

Here’s the code:

//declare variables:
int switchPin = 2; // digital input pin for a switch
int redlLedPin = 3; // diagital output pin for a LED
int redrLedPin = 4; // diagital output pin for a LED
int switchState = 0; // the state of the switch

void setup() {
pinMode(switchPin, INPUT); // set the switch pin to be an input
pinMode(redlLedPin, OUTPUT); // set the yellow pin to be an output
pinMode(redrLedPin, OUTPUT); // set the red pin to be an output
}

void loop() {
// read the switch input:
switchState = digitalRead(switchPin);

if (switchState == 0) {
// if the switch is open:
digitalWrite (redlLedPin, LOW); // turn on the left eye LED
digitalWrite (redrLedPin, LOW); // turn off the right eye LED
}
else {
// if the switch is closed:
digitalWrite (redlLedPin, HIGH); // turn on the left eye LED
delay (55); // wait for a little bit
digitalWrite (redrLedPin, HIGH); // turn on the right eye LED
delay (50); // wait for a little bit
digitalWrite (redlLedPin, LOW); // turn off the left eye LED
delay (50); // wait for a little bit
digitalWrite (redrLedPin, LOW); // turn off the right eye LED
delay (50); // wait for a little bit

}
}

It was a blast working with Emily, who is always fun to work with because of her energy, ideas, and great (often self-deprecating) sense of humor.