Ok Thanks in advance for being here.
What im trying to do is about like the title says. Simply combine the two. I realize its not that simple. I have managed to get the
two codes too work together but the fade command has to wait on the blink command so I know thats not what i want. Would be really appreciated if someone would spend a minute and post an example of the two codes working together in a way that they have there own timing. this is what i came up with. is this the best i can expect to do? im not sure. guessing not. Also for some reason. pin 10 is only reading .15v where as pin 9 is showing 2.5v. The led does blink though.
What im trying to do is about like the title says. Simply combine the two. I realize its not that simple. I have managed to get the
two codes too work together but the fade command has to wait on the blink command so I know thats not what i want. Would be really appreciated if someone would spend a minute and post an example of the two codes working together in a way that they have there own timing. this is what i came up with. is this the best i can expect to do? im not sure. guessing not. Also for some reason. pin 10 is only reading .15v where as pin 9 is showing 2.5v. The led does blink though.
C:
int bled = 10;
int led = 9;
int brightness = 0;
int fadeAmount = 5;
void setup()
{ pinMode(led, OUTPUT);
pinMode(bled, OUTPUT); }
void loop()
{ analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 255)
{fadeAmount = -fadeAmount;}
delay(60);
if (brightness <= 0)
analogWrite(bled, HIGH);
if (brightness >= 255)
analogWrite(bled, LOW);}
Last edited by a moderator: