Светофор
#define F_CPU 8000000L
#include
#include
int main(void)
{
DDRD = 0x07;
DDRB=0x00;
PORTB=0x01;
while(1)
{
if (!(PINB&0x01))
{
PORTD=0x01;
_delay_ms(2200);
PORTD=0x03;
_delay_ms(200);
PORTD=0x04;
_delay_ms(1500);
PORTD=0x00;
_delay_ms(100);
PORTD=0x04;
_delay_ms(100);
PORTD=0x00;
_delay_ms(100);
PORTD=0x04;
_delay_ms(100);
PORTD=0x00;
_delay_ms(100);
PORTD=0x02;
_delay_ms(200);
}
else
{
PORTD=0x02;
_delay_ms(100);
PORTD=0x00;
_delay_ms(100);
}
}
}