Created
September 26, 2010 04:58
-
-
Save Goddard/597618 to your computer and use it in GitHub Desktop.
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
#define F_CPU 1000000 // by default we have the 1MHz internal oscillator | |
#include <avr/io.h> // this contains all the IO port definitions | |
#include <util/delay.h> | |
int main(void) { | |
DDRB = (1 << PB5); // set PORTB5 to an output | |
DDRC = (1 << PC1); // set PORTC1 to an output | |
while (1) { | |
PORTB |= 1 << PB5; // turn LED on | |
_delay_ms(100); | |
PORTB &= ~(1 << PB5); // turn LED on | |
_delay_ms(100); | |
} | |
while (1) { | |
PORTC |= 1 << PC1; // turn LED on | |
_delay_ms(100); | |
PORTC &= ~(1 << PC1); // turn LED on | |
_delay_ms(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
define F_CPU 1000000 // by default we have the 1MHz internal oscillator
include <avr/io.h> // this contains all the IO port definitions
include <util/delay.h>
int main(void) {
DDRB = (1 << PORTB5); // set PORTB5 to an output
DDRC = (1 << PORTC1); // set PORTC1 to an output
while (1) {
PORTB |= 1 << PORTB5; // turn LED on
_delay_ms(100);
PORTB &= ~(1 << PORTB5); // turn LED on
_delay_ms(100);
}
}