Hi all,
i went and got myself a Arduino Mega1280 and started to play with the onboard LED. It did not take me long to find a weird outcome to what i thought was a simple LED app.
I tried to do a basic LED app using PWM to fade the LED in and out. As it turns out, it does not work well.
i am using the following code. I have attached the file as well.
int PWMpin=13;
int PWMwidth=0;
void setup()
{
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(PWMpin,OUTPUT);
}
void loop()
{
ledUP();
delay(500);
LedDown();
delay(500);
}
void ledUP()
{
//delay(100);
for (PWMwidth = 0; 255; PWMwidth++)
{
analogWrite(13, PWMwidth);
delay(10);
}
}
void LedDown()
{
//delay(100);
for (PWMwidth = 255; PWMwidth>0; PWMwidth--)
{
analogWrite(13, PWMwidth);
delay(10);
}
}
I am use Arduino Version 0022 on Ubuntu 11.04.
Can anybody replicate this issue or am i doing something wrong?
Regards