/*
* zadanie3.c
*
* Created: 22.10.2015 11:45:17
* Author: d14valicek
*/
#define F_CPU 1000000UL
#include
#include
#include
int main(void)
{
DDRD = 0xFF; //vystup
DDRC = 0x00; //vstup
while(1)
{
if (bit_is_clear(PINC, 0))
{
for(int c = 1; c <= 256; c=(c*2))
{
int a = c - 1;
PORTD =~a;
_delay_ms(500);
}
}
else if (bit_is_set(PINC, 0))
{
for(int c = 256; c >= 1; c=(c/2))
{
int a = c - 1;
PORTD = ~a;
_delay_ms(500);
}
}
}
return 0;
}