Thursday, September 25, 2008

The Initial Prototype + Code

a. at the highest intensity.

b. mid-range.

c. at the lowest intensity = 0.

d. connections - breadboard - resistor - sensor.

e. connections - computer - LED - arduino board - breadboard.

----------------------------------------------------------------------------------------------------------------------------------------

CODE:

int potPin = 2; // select the input pin for the potentiometer
int ledPin = 11; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
int por = 0;

void setup() {

Serial.begin(9600);

pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT

}

void loop() {

val = analogRead(potPin); // read the value from the sensor
Serial.println (val, DEC);
if (val>0)
por = val/4;
analogWrite(ledPin, por);

//val = analogRead(por);



}

----------------------------------------------------------------------------------------------------------------------------------------






No comments: