#include <avr/io.h> 
#define sbi(x, y) x |= _BV(y)    
#define cbi(x, y) x &= ~(_BV(y)) 
#define tbi(x, y) x ^= _BV(y)    
#define is_high(x, y) ((x & _BV(y)) == _BV(y))
int main(void)
{
    DDRB = 0xff; 
    PORTB = 0x00;
    DDRD = 0x00; 
    PORTD = 0xff;
    while(1) 
    {
        unsigned char i, j, k;
        for(j = 0; j < 100; j++)
        {
            for(k = 0; k < 255; k++)
            {
                for(i = 0; i < 100; i++)
                {
                    if(i < j)
                        sbi(PORTB, PB0);
                    else
                        cbi(PORTB, PB0);
                }
            }
        }
        for(j = 0; j < 100; j++)
        {
            for(k = 0; k < 255; k++)
            {
                for(i = 100; i > 0; i--)
                {
                    if(i > j)
                        sbi(PORTB, PB0);
                    else
                        cbi(PORTB, PB0);
                }
            }
        }
    }
    return 0;
}