//  flashing_leds.c -- does something with input PORTD onto output PORTB
//  implemented and tested on an AT90S8515 & STK500 
// 
//  Copyleft (!C) 2003 S. Mann and C. Manders,
// (http://www.gnu.org/copyleft/gpl.html)
//  based on Stephen Lacy's "mirror.c"


//#include <io-avr.h> (doesn't compile when this is there)
#include <avr/io.h>
#include <avr/wdt.h> 
//#include <unistd.h>

void delay(long N) {
    long n;
    for (n=0; n<N; n++);
}

int main(void) {
    wdt_disable();
    
    outp (0xFF,DDRB); /* Data Direction Register B;
    		 1 means output; 0 means input */
    outp (0x00,DDRD); /* PORTD is all Direction 0 (input) */

    //outp(0,PORTB);
    while (1) {
	unsigned char x, y;
	//x = inp(PIND);
	y = 0;
        outp (y,DDRB);
	//outb(y, PORTB);
	//usleep(500000);
	delay(500000);
	y=255;
        outp (y,DDRB);
	//outb(y, PORTB);
	delay(500000);
	//outb(x, PORTB);
	//delay(500000);
    }
}

