]>
Commit | Line | Data |
---|---|---|
d7bda89e MG |
1 | #define F_CPU 1000000UL\r |
2 | \r | |
3 | #include <avr/io.h>\r | |
4 | \r | |
5 | int main(void)\r | |
6 | {\r | |
7 | uint8_t pb = 0x00;\r | |
8 | int8_t dir = 1;\r | |
9 | volatile uint16_t i;\r | |
10 | \r | |
11 | DDRB = 0xff;\r | |
12 | \r | |
13 | while(1) {\r | |
14 | pb += dir;\r | |
15 | PORTB = pb;\r | |
16 | \r | |
17 | for (i = 0; i < (pb<<5); i++) {}\r | |
18 | \r | |
19 | if ((pb == 0) || (pb == 0xff))\r | |
20 | dir = -dir;\r | |
21 | }\r | |
22 | \r | |
23 | return 0;\r | |
24 | }\r |