Hello,
New to the Forum and probably not doing this right, although I did search and attempted multiple solutions, to no avail.
What I am trying to achieve, coding wise, is the following:
1 Blinking LED
2 Steady LED's
2 Independently Fading LED's
eventually I need to add 4 more steady LED's but trying to get this first.
My code currently is as follows: the Fading LED's (3 & 6) are fading to close together and I would like to offset that but I can not seem to figure it out.
int value, value2, value3 ;
int ledpin = 3; // light connected to digital pin 3
int ledpin2 = 6; // light connected to digital pin 6
int ledpin3 = 7; // light connected to digital pin 7
long time=0
;
int periode = 1000;
int displace = 100;
void setup()
{
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
}
void loop()
{
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
time = millis();
value = 128+127*cos(2*PI/periode*time);
value2 = 128+127*cos(2*PI/periode*(displace-time));
value3 = 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)
analogWrite(ledpin3, value3); // sets the value (range from 0 to 255)
}