#define set0(r,b) r&= ~(1<<b)
#define set1(r,b) r |= 1<<b
#define test(r,b) ( r&(1<<b) )
String functions[] = {"one()", "two()", "three()"};
//int pins[7] = {2, 3, 4, 5, 6, 7, 8};
int count = 1;
bool again = false;
void setup() {
set1(DDRD, 0); //output
set1(PORTD, 0); //high
set1(DDRD, 1); //output
set1(PORTD, 1); //high
set1(DDRD, 2); //output
set1(PORTD, 2); //high
set1(DDRD, 3); //output
set1(PORTD, 3); //high
set1(DDRD, 4); //output
set1(PORTD, 4); //high
set1(DDRD, 5); //output
set1(PORTD, 5); //high
set1(DDRD, 6); //output
set1(PORTD, 6); //high
set1(DDRD, 7); //output
set1(PORTD, 7); //high
set1(DDRB, 0); //output
set1(PORTB, 0); //high
//nastavenie tlacitka
pinMode(11, INPUT);
digitalWrite(11, HIGH);
Serial.begin(9600);
Serial.println("ôd");
attachInterrupt(digitalPinToInterrupt(11), aa, FALLING);
}
void loop() {
if(count == 1)
{
one();
count++;
delay(500);
}
if(count == 2)
{
two();
count++;
delay(500);
}
if(count == 3)
{
three();
count=1;
delay(500);
}
/*one();
delay(1000);
two();
delay(1000);
three();
delay(1000);*/
}
void off()
{
set1(PORTD, 0); //high
set1(PORTD, 1); //high
set1(PORTD, 2); //high
set1(PORTD, 3); //high
set1(PORTD, 4); //high
set1(PORTD, 5); //high
set1(PORTD, 6); //high
set1(PORTD, 7); //high
set1(PORTB, 0); //high
}
void aa()
{
Serial.print("fd");
}
void one()
{
off();
set0(PORTD, 2); //low
set0(PORTD, 5); //low
}
void two()
{
off();
set0(PORTD, 3); //low
set0(PORTD, 4); //low
set0(PORTD, 5); //low
set0(PORTD, 6); //low
set0(PORTB, 0); //low
}
void three()
{
off();
set0(PORTD, 2); //low
set0(PORTD, 5); //lowd
set0(PORTD, 6); //lowd
set0(PORTB, 0); //low
set0(PORTD, 3); //lowd
}
void four()
{
off();
}