LED Dimmer not working


hi,
i trying make simple led dimmer. values taken in serially.
here code
code: [select]
 
const int analogoutpin = 9;

int sensorvalue = 0;       

void setup() {
 
  serial.begin(9600);
}

void loop() {
 
  if (serial.available() > 1){
  sensorvalue = serial.read();
 
 
  analogwrite(analogoutpin, sensorvalue);

 
  serial.println("output = ");
  serial.print(sensorvalue);
 
 
  delay(2);
  }
}


the led not changing light intensity. using 10k resister @ led. tried using dimmer using potentiometer. no significant changes in led seen. going wrong?

switch serial.print , serial.println

what seeing in serial monitor?

what's happening sensor returning values between 0-1023, analogwrite writes between 0-255.

but why use >1 serial available?


Arduino Forum > Using Arduino > Project Guidance > LED Dimmer not working


arduino

Comments

Popular posts from this blog

Valutazione Template - Joomla! Forum - community, help and support

SD Datastring Convention

First use of Arduino Uno : avrdude error on Blink uploading