Created
July 4, 2013 07:58
-
-
Save nuttt/5925755 to your computer and use it in GitHub Desktop.
AVR Lab 3-2
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
#include <avr/io.h> | |
#define F_CPU 1600000UL | |
#include <util/delay.h> | |
#define PORT_LED PORTB | |
#define DIR_LED DDRB | |
#define LED1 1 | |
#define LED2 2 | |
#define BTN 0 | |
void delay_ms(unsigned int time){ | |
while(time-- > 0){ | |
_delay_ms(100.0); | |
} | |
} | |
int main(void){ | |
DIR_LED |= (1<<LED1); | |
DIR_LED |= (1<<LED2); | |
// Internal Pull up | |
PORTB |= (1<<BTN); | |
while(1){ | |
PORTB ^= (1<<LED1); | |
delay_ms(100); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment