We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f29569 commit 34a2ffaCopy full SHA for 34a2ffa
C_LED_as_binary_counter/main.c
@@ -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