Skip to content
aurelient edited this page May 20, 2012 · 4 revisions

A simple HelloWorld (blinking LED) for ATtiny 13

by Michael Shimniok - http://www.bot-thoughts.com

/** ATtiny13 hello world; blink LED on Pin 2
 *
 * Michael Shimniok - http://www.bot-thoughts.com
 */
#include <avr io.h>
#include <avr interrupt.h>
#include <avr sleep.h>
#include <util delay.h> 
int main(int argc, char **argv)
{
 DDRB |= _BV(3);  // PB3 (pin2) as output
 while (1) {
  PORTB |= _BV(3); // turn on LED
  _delay_ms(500);
  PORTB &= ~_BV(3); // turn off LED
  _delay_ms(500);
 }
}

Clone this wiki locally