All pastes #1603922 Raw Edit

sai

public cpp v1 · immutable
#1603922 ·published 2009-10-08 11:19 UTC
rendered paste body
/*** An introductory C program for AVR microcontrollers* Flashes a LED connected to PORTB of the device*//* These are avr-libc header files */#include<avr/interrupt.h>#include<util/delay.h>int main(void){	/* Initialise PortB, bit0 as output */	/* DDRB is the Data Direction Register for PortB */	DDRB = _BV(PB0);		/* the main loop */	for(;;)	{		/* set PortB, bit0 */		/* this turns on the LED */		PORTB |= _BV(PB0);				/* delay for 250 milliseconds */		/* _delay_ms() is a avr-libc function */		/* argument: number of milliseconds for delay */				_delay_ms(250);				/* unset PortB, bit0 */		/* this turns off the LED */		PORTB &= ~_BV(PB0);				/* delay again */		_delay_ms(250);	}	return 0; /* will never reach here! */}