For tech demo three I designed, drafted and laser cut the parts of a car, and then attached a DC motor to a fan to propel it into action!  Thanks to Zack for helping me develop the design of the car.  Took a few iterations of the size and shape of the fan for the car to move.  In the end I used a photo light sensor as input, and wrote the code so that the blades of the fan would rotate depending on how much light the sensor was receiving.

The code is pretty simple, and is attached below:


int sensorPin = A0;    //  input pin
int sensorValue = 0;

void setup() {
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
Serial.begin(9600);
}

void loop() {
sensorValue = analogRead(sensorPin);
int power = map(sensorValue, 800,900,0,255);
if (power > 255) power = 255;
if (power < 0) power = 0;
digitalWrite(6,LOW);
analogWrite(7,power);
Serial.println(power);  //to check sensor output
Serial.print("SensorValue:  ");
Serial.println(sensorValue);
}