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