#define F_CPU 16000000UL

#include <avr/io.h>
#include <util/delay.h>
#include <stdint.h>

int main(void)
{

    DDRB |= (1 << PB2) | (1 << PB5);
    DDRC |= (1 << PC3);
    DDRD |= (1 << PD5);

    
    uint8_t counter_B2 = 0;
    uint8_t counter_B5 = 0;
    uint8_t counter_C3 = 0;
    uint8_t counter_D5 = 0;


    uint8_t state_B2 = 1;
    uint8_t state_B5 = 1;
    uint8_t state_C3 = 1;
    uint8_t state_D5 = 1;

    
    PORTB |= (1 << PB2) | (1 << PB5);
    PORTC |= (1 << PC3);
    PORTD |= (1 << PD5);

    
    while (1)
    {
        _delay_ms(1000);

        
        counter_B2++;

        if (state_B2 == 1 && counter_B2 >= 1)
        {
            PORTB &= ~(1 << PB2);
            state_B2 = 0;
            counter_B2 = 0;
        }
        else if (state_B2 == 0 && counter_B2 >= 1)
        {
            PORTB |= (1 << PB2);
            state_B2 = 1;
            counter_B2 = 0;
        }

        
        counter_B5++;

        if (state_B5 == 1 && counter_B5 >= 5)
        {
            PORTB &= ~(1 << PB5);
            state_B5 = 0;
            counter_B5 = 0;
        }
        else if (state_B5 == 0 && counter_B5 >= 1)
        {
            PORTB |= (1 << PB5);
            state_B5 = 1;
            counter_B5 = 0;
        }

        
        counter_C3++;

        if (state_C3 == 1 && counter_C3 >= 3)
        {
            PORTC &= ~(1 << PC3);
            state_C3 = 0;
            counter_C3 = 0;
        }
        else if (state_C3 == 0 && counter_C3 >= 3)
        {
            PORTC |= (1 << PC3);
            state_C3 = 1;
            counter_C3 = 0;
        }

    
        counter_D5++;

        if (state_D5 == 1 && counter_D5 >= 2)
        {
            PORTD &= ~(1 << PD5);
            state_D5 = 0;
            counter_D5 = 0;
        }
        else if (state_D5 == 0 && counter_D5 >= 4)
        {
            PORTD |= (1 << PD5);
            state_D5 = 1;
            counter_D5 = 0;
        }
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: