Commit | Line | Data |
---|---|---|
1375f65d H |
1 | #include <avr/io.h> |
2 | #include <util/delay.h> | |
3 | ||
4 | //#include <compat/deprecated.h> | |
5 | /* | |
6 | variable = PINx; // Read a byte from a port, replace x with the port number | |
7 | PORTx = variable; //Write a byte to a port | |
8 | PORTx |= 1<<pin_number; // Set a pin in a port | |
9 | PORTx &= ~(1<<pin_number); // Clear a pin in a port | |
10 | */ | |
11 | ||
12 | void delay(unsigned int ms) { | |
13 | unsigned int i,j; | |
14 | for ( j=0; j<1000; j++) | |
15 | for ( i=0; i<ms; i++); | |
16 | } | |
17 | ||
18 | int main (void){ | |
19 | ||
20 | //sbi(DDRD,PD5); /*enable port 5 for output*/ | |
21 | DDRD |= 1<<5; | |
22 | ||
23 | while (1) { | |
24 | //cbi (PORTD, PD5); | |
25 | PORTD &= ~(1<<5); | |
26 | delay (500); | |
27 | //sbi (PORTD, PD5); | |
28 | PORTD |= 1<<5; | |
29 | delay (500); | |
30 | } | |
31 | ||
32 | return 0; | |
33 | } |