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!

motor controlled by led

Project Members: 
Wenhua Shi

i play with led and photocell,

placing them in a dark coll box,
using photocell val to control motor speed.


* one pot fades one motor
* modified version of AnalogInput
* by DojoDave <>
* Modified again by dave
int ledPin = 7;
int potPin = 0;   // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
void setup() {
  pinMode(ledPin, OUTPUT); 
void loop() {
  val = analogRead(potPin);    // read the value from the sensor, between 0 - 1024
  analogWrite(motorPin, val/4);
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(5000);         // analogWrite can be between 0-255

noname-1.jpeg63.08 KB


Comments from TAs

This seems to work, but it's not clear what type of interaction you're trying to create with the photocell/motor speed interaction -- What is the relationship between the two components, and what type of interface might be built around the interaction?

Your photo makes it fairly difficult to see what your interface actually does. Do you have a clearer one?

Powered by Drupal - Design by Artinet