Assignment 4.2

Post date: Jun 28, 2010 2:23:28 AM

Well after about an hour of failed attempts at trying to hook up wires to 2 of the balls on my newton's cradle (would have been awesome right?) I got the idea of using the contact between the conveniently metal strings and metal frets on my guitar to complete a circuit to the LED(s). Here's a video:

Interestingly enough this didn't work on my electric guitar because the bridge was made of metal, essentially "pushing the button" 100% of the time. I'm really wishing I had more LEDs and alligator clips (and quite frankly, more time) to hook up one for every fret, but that's an experiment for another day.

EDIT:

Sorry about that one Mr. Dickie, I think I thought the code was so simple that I didn't need to include it (stupid, I know). I actually didn't save it for the same reason, but I remember it being something like this:

const int switch1 = 5; // the number of the "pushbuttons"

const int switch2 = 4;

const int led1 = 12;

const int led2 = 13;

void setup() {

// set switch pins to input

pinMode(switch1, INPUT);

pinMode(switch2, INPUT);

// set led pins to output

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

}

void loop()

{

// write to the LEDs depending on the state of the "switches"

digitalWrite(led1, digitalRead(switch1));

digitalWrite(led2, digitalRead(switch2));

}