All pastes #741848 Raw Edit

avr hello world

public text v1 · immutable
·published 2007-10-19 00:42 UTC
rendered paste body
//Distributed under the GPL v 2.0
//by fenn 10/03/06
//simple test program blinks an LED on and off

#include <avr/io.h>

//for a delay of 1 second, n = about 23000
void delay(long n) 
{
	long a;
	for(a=0;a<n;a++)
	{
		
	}
}


int main(void)
{    
	char *c = "wheee";
	DDRD=0xFF; //set port D to output
	while(1)
	{
		PORTD=0xFF; //turn the led on
		delay(10000);
		PORTD=0x00; //turn the led off
		delay(10000);
	}
}