I just bought a Arduino Uno a couple days ago and I've been working on a project where there are 9 LEDS in total and want 3 to be pulsing in and out but the other 6 moving down a line so they are moving in a sense. Since I have limited experience in c++, does anyone have any advice to achieve these 2 loops simultaneously? Any help is greatly appreciated!
int value, value2 ;
int ledpin = 10;
int ledpin2 = 11;
long time=0;
int periode = 2000;
int displace = 500;
void setup()
{
// nothing for setup
}
void loop()
{
time = millis();
value = 128+127*cos(2*PI/periode*time);
value2 = 128+127*cos(2*PI/periode*(displace-time));
analogWrite(ledpin, value); // sets the value (range from 0 to 255)
analogWrite(ledpin2, value2); // sets the value (range from 0 to 255)
}