Toggle navigation
Toggle navigation
This project
Loading...
Sign in
공정훈
/
test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
공정훈
2022-06-12 01:24:15 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a306e412f1a037aab8cb95cde16e1ce08cccdaa7
a306e412
0 parents
led odd and even
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
iotsw2-2_1.c
iotsw2-2_1.c
0 → 100644
View file @
a306e41
#include <wiringPi.h>
#define LED_ON 1
#define LED_OFF 0
const
int
Led
[
16
]
=
{
4
,
17
,
18
,
27
,
22
,
23
,
24
,
25
,
6
,
12
,
13
,
16
,
19
,
20
,
26
,
21
};
void
LEDControl
(
int
n
)
{
int
i
;
for
(
i
=
0
;
i
<
16
;
i
++
)
{
if
(
i
==
n
)
digitalWrite
(
Led
[
i
],
LED_ON
);
else
digitalWrite
(
Led
[
i
],
LED_OFF
);
}
}
int
main
(
void
)
{
int
i
;
if
(
wiringPiSetupGpio
()
==
-
1
)
return
1
;
for
(
i
=
0
;
i
<
16
;
i
++
)
{
pinMode
(
Led
[
i
],
OUTPUT
);
digitalWrite
(
Led
[
i
],
LED_OFF
);
}
while
(
1
)
{
for
(
i
=
0
;
i
<
16
;
i
+=
2
)
{
LEDControl
(
i
);
delay
(
500
);
}
for
(
i
=
1
;
i
<
16
;
i
+=
2
)
{
LEDControl
(
i
);
delay
(
500
);
}
}
return
0
;
}
Please
register
or
login
to post a comment