Lab 3 - 3 Potentiometers 3 LEDs

Submitted by vstarostenko on Tue, 02/19/2013 - 16:19

The page would not allow me to upload video. I do have a clip of the potentiometers controlling the LEDs.

CODE:

int potPin1 = 1;
int potPin2 = 2;
int potPin3 = 3;
int potValue = 0;  
int led9 = 9;      
int led10 = 10; 
int led11 = 11; 
 
 
void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  // declare the led pin as an output:
  pinMode(led9, OUTPUT);
  pinMode(led10, OUTPUT);
  pinMode(led11, OUTPUT);
}
 
void loop() {
  potValue = analogRead(potPin1);
  analogWrite(led9, potValue/4);
  potValue = analogRead(potPin2);
  analogWrite(led10, potValue/4);
  potValue = analogRead(potPin3);
  analogWrite(led11, potValue/4);
  Serial.println(potValue/4);      
  delay(10);                     
}
WP_20130219_002.jpg
0
Your rating: None
Drupal theme by Kiwi Themes.