Saturday, February 7, 2009

Week 4

Sketch One: The Scouter

For details regarding the Scouter, please see the previous week's post or the PDF attached.

The construction of the scouter proved to be a difficult but rewarding experience. Mounting a light-blocking aesthetic to the outside of a pair of sunglasses and wiring some LEDs and sensors to the inside and outside of it wasn't as easy as we thought. In the end the wires became a little messy and the arduino board become unstable. The distance and proximity sensors worked as we had desired, however, and the device performed exactly as intended (with the exception to one LED not being as bright as we wanted).

Arduino Code:

int potPin = 2; // select the input pin for the potentiometer
int potPin2 = 3;
int ledPin = 13; // select the pin for the LED
int ledPin2 = 12;
int val = 0; // variable to store the value coming from the sensor
int val2 = 0;

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600);
Serial.println("Systems On");
}

void loop() {

val = analogRead(potPin); // read the value from the sensor
Serial.println(val);
val2 = analogRead(potPin2);
Serial.println(val2);

if (val > 100) {
Serial.print("Object Detected on Sensor 1");
digitalWrite(ledPin, HIGH); // turn the ledPin on
} else {
digitalWrite(ledPin, LOW); // turn the ledPin off
}
if (val2 > 100) {
Serial.println ("Object Detected on Sensor 2");
digitalWrite(ledPin2, HIGH); // turn the ledPin on
} else {
digitalWrite(ledPin2, LOW); // turn the ledPin off
}
}


Slides:

SketchOneSlides.pdf

Photos:


No comments:

Post a Comment