hello guys,
i'm trying implement fade in-out function led
when runs how is, works great, when implement code program, dont works @ all.
i've tryied put code while it's didn't worked out.
my program looks this:
i spended on several hours no result. gladly appreciated! thank you!
i'm trying implement fade in-out function led
code: [select]
int value;
int ledpin = 9; // light connected digital pin 10
long time=0;
void setup()
{
// nothing setup
}
void loop()
{
value = 128+127*cos(2*pi/10000*millis());
analogwrite(ledpin, value); // sets value (range 0 255)
}
when runs how is, works great, when implement code program, dont works @ all.
i've tryied put code while it's didn't worked out.
my program looks this:
code: [select]
int value;
int ledpin = 9; // light connected digital pin 10
long time=0;
int periode = 10000;
void setup()
{
// setting stuff
}
void loop()
{
if (true)
{
if(buf[0]=='2')
{
{
value = 128+127*cos(2*pi/10000*millis());
analogwrite(ledpin, value); // sets value (range 0 255)
}
if(buf[0]=='3')
{
digitalwrite(9, low);
}
} else {
digitalwrite(12, high);
}
}
i spended on several hours no result. gladly appreciated! thank you!
Arduino Forum > Using Arduino > Programming Questions > LED fade not working in program
arduino
Comments
Post a Comment