Skip to content

Instantly share code, notes, and snippets.

@nuttt
Created July 4, 2013 07:58
Show Gist options
  • Save nuttt/5925755 to your computer and use it in GitHub Desktop.
Save nuttt/5925755 to your computer and use it in GitHub Desktop.
AVR Lab 3-2
#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