Created
June 1, 2013 02:54
-
-
Save electronut/5689130 to your computer and use it in GitHub Desktop.
A simple program for the ATtiny84 that blinks an LED.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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