Assignment 7.1

This one actually turned out quite swell - it's almost like I intended the animation to be used with a potentiometer from the start. After figuring out a little algebra I set the angle of the eyes rotating to be controlled by the value of the potentiometer's output through the serial port. The only tricky part was, while my delay(16) in the arduino code may seem like an arbitrary number, I actually had to tinker around with that for a while - if the number was too high, the eyes would flicker, while if it was too low (ie the data was being sent too fast), the sketch couldn't process it quickly enough and it was slow to respond, so as it turns out, the magic number is sixteen. I'm not exactly equipped to take a video right now but considering the simple nature of the program and the fact that I've already posted 2 similar sketches, you should be able to imagine with your brains how it went down. Code:

(my fancy text boxes don't seem to want to work right now so I guess I'll do this one the old-fashioned way...)

ARDUINO CODE

//I love how succinct this code is

const int pot1 = 5;

void setup () {

Serial.begin(9600); //begin serial communication at 9600 bps

}

void loop () {

//print to serial port (the /4 is there so it all fits in 1 byte for better speed)