Skip to content

Instantly share code, notes, and snippets.

@electronut
Created June 1, 2013 02:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electronut/5689130 to your computer and use it in GitHub Desktop.
Save electronut/5689130 to your computer and use it in GitHub Desktop.
A simple program for the ATtiny84 that blinks an LED.
//
// A simple program for the ATtiny84 that blinks an LED.
//
// electronut.in
//
#include <avr/io.h>
#include <util/delay.h>
#define F_CPU 8000000
int main (void)
{
// set PB1 to be output - connect your LED to pin 3
DDRB = (1 << PB1);
// loop
while (1) {
// set PB1 high
PORTB = (1 << PB1);
_delay_ms(200);
// set PB1 low
PORTB &= ~(1 << PB1);
_delay_ms(200);
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment