#define l1 2
#define l2 3
#define l3 4
int pinLED [] = {2,3,4};
int JmlPin = 3;
unsigned long nyala = 5000;
unsigned long mati = 8000;
unsigned long temp2 = 0;
unsigned long temp3 = 0;
unsigned long temp1 = 0;
unsigned long timermillis;
bool statusl1 = 1;
bool statusl2 = 0;
bool statusl3 = 0;
void setup() {
Serial.begin(9600);
for (int x=0; x<JmlPin; x++)
{
pinMode(pinLED[x], OUTPUT);
}
}
void loop() {
timermillis = millis(); //memulai timer
/*
if (statusl1==1)
{
if(timermillis-temp1 >= nyala)
{
statusl1=!statusl1;
temp1=timermillis;
}
}
else
{
if(timermillis-temp1 >= mati)
{
statusl1=!statusl1;
temp1=timermillis;
}
}
*/
if(timermillis-temp2 >= 4000)
{
statusl2=!statusl2;
temp2 = timermillis;
/*if (statusl2==1)
{
if(timermillis - temp2 >= nyala)
{
statusl2=!statusl2;
// temp2=(timermillis-4000);
}
}
else
{
if(timermillis-temp2>= mati)
{
statusl2=!statusl2;
// temp2=(timermillis-4000);
}
}*/
}
digitalWrite(l1, statusl1);
digitalWrite(l2, statusl2);
}