Created
February 18, 2016 10:27
-
-
Save pilinux/29bcc01380f3e920e8c0 to your computer and use it in GitHub Desktop.
Lab 2 (AVR C)
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
// Preamble | |
#include <avr/io.h> | |
#include <util/delay.h> /* Time delay function */ | |
// Function definitions | |
#define LED_DDR DDRB | |
#define LED_PORT PORTB | |
//main function | |
int main(void) | |
{ | |
// Initialization | |
LED_DDR = 0b00000001; // Set the first pin of Port B as output | |
// Event loop | |
while(1) { | |
LED_PORT = 0b00000001; // Turn on first pin in Port B | |
_delay_ms(500); // Wait 500 ms | |
LED_PORT = 0b00000000; // Turn off first pin in Port B | |
_delay_ms(500); // Wait 500 ms | |
} | |
return(0); // This line is never reached | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment