Announcements

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!


Mr. Clean Does It All

Project Members: 
Kathleen Lu

Mr. Clean Does It All

Use the Arduino and FSR along with a Mr. Clean sponge half
to control a light emitting diode. Due to technical difficulties
experienced at home, I couldn't implement my original design
of an interactive cat toy and FSR (I'm uploading from school, so
no access to my cats).

Components Used

Light Emitting Diode (LED)
Resistor

Arduino Code

/*
 * Resistive Sensor Input
 * Takes the input from a resistive sensor, e.g., FSR or photocell
 * Dims the LED accordingly, and sends the value (0-255) to the serial port
 */
int sensorPin = 0;  // select the input pin for the sensor
int ledPin = 11;    // select the output pin for the LED
int val = 0;        // variable to store the value coming from the sensor
void setup() {
  Serial.begin(9600);
}
void loop() {
  val = analogRead(sensorPin); // read the value from the sensor, 0-1023
  analogWrite(ledPin, val/4);  // analogWrite (dimming the LED) can be between 0-255
  Serial.println(val/4);       // writing the value to the PC via serial connection
  delay(500);                   // rest a little...
}

Image

Mr. Clean and embedded FSRMr. Clean and embedded FSR


Comments

cute, Kathleen. Thanks for

cute, Kathleen. Thanks for getting this up for me.


Powered by Drupal - Design by Artinet