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!


Revision of Lab6- Optical Vehicle from Thu, 10/11/2007 - 07:53

Project Members: 
Hsin-Hsien Chiu

Description: Optical VehicleSince I only have one DC motor, a set of gears is adopted to apply one DC motor into two directions. The original setup for this optical vehicle is only two wheels; however, it’s hard to be balanced when putting something on it. Thus, two small extra wheels are added in the front part of the model. The motion of the Optical Vehicle is controlled by a FSR. The major wheels emits green and blue light separately, controlled by the other FSR and photocell sensor.  Components: Two force pressure resistors, one photocell sensor, Arduino board, breadboard, wires, Blue and Green LEDs, one silicon translucent ball, a set of gears.  

Arduino Code:

/*
 * DC motors Input
 * Resistive Sensor Input
 * Takes the input from a resistive sensor, e.g., FSR or photocell
  * by Hsin-Hsien Chiu, 2007
 */


int sensor1Pin = 0;  // select the input pin for the sensor

int sensor2Pin = 1;

int moterPin = 2;

int BluePin = 11;    // select the output pin for the LED

int GreenPin = 10;

int morterPin = 9;

int sensor1val = 0;        // variable to store the value coming from the sensor

int sensor2val = 0;

int moterval = 0;

void setup() {

  Serial.begin(9600);
  beginSerial(9600);
 

}

void loop() {
 

  sensor1val = analogRead(sensor1Pin); // read the value from the sensor, 0-1023

  sensor2val = analogRead(sensor2Pin);

  moterval = analogRead(moterPin);

  
 
 
  analogWrite(BluePin, sensor1val/4);  // analogWrite (dimming the LED) can be between 0-255

  analogWrite(GreenPin, sensor2val/4);

  analogWrite(morterPin, moterval/4);

  Serial.println(sensor1val/4);       // writing the value to the PC via serial connection

  Serial.println(sensor2val/4);

  Serial.println(moterval/4);

  delay(50);                   // rest a little...

}

 


  Movies:

 Images:


Powered by Drupal - Design by Artinet