Skip to content

Instantly share code, notes, and snippets.

@julioceaseless
Forked from holachek/main.c
Last active September 20, 2015 00:20
Show Gist options
  • Save julioceaseless/8e39221546244083b11d to your computer and use it in GitHub Desktop.
Save julioceaseless/8e39221546244083b11d to your computer and use it in GitHub Desktop.
modified main.c slightly
#define F_CPU 1000000 // CPU frequency for proper time calculation in delay function
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRD |= (1 << PD6); // make PD6 an output
for(;;)//infinite loop
{
PORTD |= (1 << PD6); // turn on PD6
_delay_ms(500); // delay for 500 ms
PORTD &= (0 << PD6); // turn off PD6 by masking using the AND operation
_delay_ms(1000); // delay for 1 s
}
return 0; // the program executed successfully
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment