Skip to content

Commit 34a2ffa

Browse files
authored
Add files via upload
1 parent 8f29569 commit 34a2ffa

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

C_LED_as_binary_counter/main.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* C_LED_as_binary_counter.c
3+
*
4+
* Created: 20.11.2022. 22:28:39
5+
* Author : Aleksandar Bogdanovic
6+
*/
7+
8+
#define F_CPU 16000000UL // Defined clock at 16MHz
9+
10+
#include <avr/io.h>
11+
#include <stdint.h>
12+
#include <util/delay.h>
13+
14+
void delay(int time);
15+
16+
int main(void) {
17+
DDRD = 0xFF;
18+
PORTD = 0;
19+
20+
while(1) {
21+
PORTD ++;
22+
_delay_ms(100);
23+
}
24+
}
25+
26+
void delay(int time) {
27+
int i, j;
28+
for(i = 0; i <= time; i++)
29+
{
30+
for(j = 0; j < 23; j++)
31+
{
32+
33+
}
34+
}
35+
}
36+
37+
38+

0 commit comments

Comments
 (0)