Skip to content

Instantly share code, notes, and snippets.

@ericevenchick
Last active September 20, 2022 18:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ericevenchick/5331486 to your computer and use it in GitHub Desktop.
Save ericevenchick/5331486 to your computer and use it in GitHub Desktop.
Blinking LED for Arduino in C
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
// set all PORTB pins for output
DDRB = 0xFF;
for (;;) {
// toggle PORTB pins
PORTB ^= 0xFF;
// wait one second
_delay_ms(1000);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment