So I got 2 working with one going off and one turning on back on. Now I'm trying to figure out if I wanted to both to raise or dim the LED brightness at the same time. Instead of one at time like in the code below.
void setup () {
pinMode (8,OUTPUT);
pinMode (7,OUTPUT);
}
void loop () {
int x = 1;
for (int i = 0; i > -1; i = i + x) {
analogWrite(8,i);
if (i == 255) {
x = -1;
}
delay(10);
}
int a = 1;
for (int b = 0; b > -1; b = b + a) {
analogWrite(7,b);
if (b == 255) {
a = -1;
}
delay(10);
}
}
Clearly you would put both analogWrite statements in the same loop to do this.
However, you need to study this explanation to understand how to write useful programs.
Thank you my good friend! I was thinking something like that that the need to be in something together but didn't know what or how to do it. But ya still learning the basics and trying to figure out how all the mechanics work. I'm still on LED lights been 3 weeks lol. Dont want to rush, that's why. Want to make sure how every little thing works.
I wanted to both to raise or dim the LED brightness at the same time.
try one for loop:
untested:
for (int i = 0; i <= 255; i++) {
analogWrite(8, i);
analogWrite(7, 255 - i);
delay(10); // dirty delay
}
OO thank you, got to try it. Going to take some time before I understand the logic.