Created
April 30, 2014 15:01
-
-
Save electronut/7f2b10eecd4f88f51ce0 to your computer and use it in GitHub Desktop.
A simple blinky program for ATtiny85
This file contains hidden or 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
// main.c | |
// | |
// A simple blinky program for ATtiny85 | |
// Connect red LED at pin 2 (PB3) | |
// | |
// electronut.in | |
#include <avr/io.h> | |
#include <util/delay.h> | |
int main (void) | |
{ | |
// set PB3 to be output | |
DDRB = 0b00001000; | |
while (1) { | |
// flash# 1: | |
// set PB3 high | |
PORTB = 0b00001000; | |
_delay_ms(20); | |
// set PB3 low | |
PORTB = 0b00000000; | |
_delay_ms(20); | |
// flash# 2: | |
// set PB3 high | |
PORTB = 0b00001000; | |
_delay_ms(200); | |
// set PB3 low | |
PORTB = 0b00000000; | |
_delay_ms(200); | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment