bool test1 = true;
bool test2 = true;
void setup()
{
DDRD |= 1<<2;
DDRD |= 1<<7;
DDRB &= ~(1<<0);
PORTB |= 1<<0;
DDRB &= ~(1<<1);
PORTB |= (1<<1);
}
void loop()
{
if((PINB& (1<<0)) == 0 && test1 == true )
{
test1 = false;
PORTD |= 1<<2;
krok();
}
else if ((PINB& (1<<0)) != 0 && test1 != true )
{
test1 = true;
}
if((PINB& (1<<1)) == 0 && test2 == true )
{
test2 = false;
PORTD &= ~(1<<2);
krok();
}
else if ((PINB& (1<<1)) != 0 && test2 != true )
{
test2 = true;
}
}
void krok ()
{
PORTD |= 1<<7;
delay(5);
PORTD &= ~(1<<7);
delay(5);
}