Skip to content

Instantly share code, notes, and snippets.

@Goddard
Created September 26, 2010 04:58
Show Gist options
  • Save Goddard/597618 to your computer and use it in GitHub Desktop.
Save Goddard/597618 to your computer and use it in GitHub Desktop.
@Goddard
Copy link
Author

Goddard commented Sep 26, 2010

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);

PORTC |= 1 << PORTC1;  // turn LED on
_delay_ms(100);
PORTC &= ~(1 << PORTC1);  // turn LED on
_delay_ms(100);

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment