Sunday, October 18, 2009

PWM LED

int ledPin = 10;
int analogPin = 0;
int analogValue = 0;

void setup(){
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(analogPin, OUTPUT);
}


void loop() {
  analogValue = analogRead( analogPin);
  
  analogWrite(ledPin, analogValue);
  
/*  if(analogValue == HIGH){
  analogWrite(ledPin, LOW);
  delay(200);
  }
  
  else
{
  analogWrite(ledPin, HIGH);
}*/
Serial.println(analogValue);
}
video

No comments:

Post a Comment