unsigned long int future = 0; // cislo 0 az 2na32
int stav = 0;
void setup()
{
DDRD |=1<<5; //pinMode(5, OUTPUT);
DDRD |=1<<6; //pinMode(6, OUTPUT);
DDRD |=1<<7; //pinMode(7, OUTPUT);
PORTD &=~(1<<5);
PORTD &=~(1<<6);
PORTD &=~(1<<7);
future = millis(); // urcenie zaciatocneho casu po inicializacii systemu
}
void loop()
{
if(millis() >= future) // pokial aktualny cas dosiahol stanoveny interval...
{
stav++; // kod, ktory sa vykona raz za pol sekundy
if(stav == 3)
stav = 0;
future = millis() + 200; // stanovenie noveho intervalu
}
switch(stav) // stavovy stoj
{
case 0: (PORTD |=1<<5); (PORTD &=~(1<<5)); break;
//digitalWrite(5, HIGH); digitalWrite(5, LOW); break;
case 1: (PORTD |=1<<6); (PORTD &=~(1<<6)); break;
//digitalWrite(6, HIGH); digitalWrite(6, LOW); break;
case 2: (PORTD |=1<<7); (PORTD &=~(1<<7)); break;
//digitalWrite(7, HIGH); digitalWrite(7, LOW); break;
default: break; // toto nenastane "SNÁĎ!!!"
}
}