Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wicj_embeddedlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julia Scharsich
wicj_embeddedlab
Commits
2e381def
Commit
2e381def
authored
5 years ago
by
Julia Scharsich
Browse files
Options
Downloads
Patches
Plain Diff
leds.c - not perfect but does work
parent
6da3dd8c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+8
-0
8 additions, 0 deletions
Makefile
leds.c
+21
-7
21 additions, 7 deletions
leds.c
with
29 additions
and
7 deletions
Makefile
0 → 100644
+
8
−
0
View file @
2e381def
leds.hex
:
leds.o
avr-objcopy
-j
.text
-j
.data
-O
ihex leds.o leds.hex
leds.o
:
avr-gcc leds.c
-o
leds.o
-Wall
-Wextra
-Wpedantic
-mmcu
=
atmega328p
-Os
-std
=
c99
flash
:
avrdude
-p
atmega328p
-c
gpio
-U
flash:w:leds.hex
This diff is collapsed.
Click to expand it.
leds.c
+
21
−
7
View file @
2e381def
...
@@ -4,13 +4,27 @@
...
@@ -4,13 +4,27 @@
#include
<avr/io.h>
#include
<avr/io.h>
int
main
(
void
){
int
main
(
void
){
DDRD
=
0
b
00
111111
;
DDRD
=
0
b111111
00
;
DDRB
=
0
b111111
00
;
DDRB
=
0
b
00
111111
;
PORTD
=
0
b000000
00
;
PORTD
=
0
b000000
11
;
PORTB
=
0
b00000000
;
PORTB
=
0
b00000000
;
char
on
=
0
;
while
(
1
){
while
(
1
){
if
(
PORTD
!=
0
b11111111
)
PORTD
=
PORTD
<<
1
+
1
;
while
(
!
on
){
if
(
PORTB
!=
0
b11111111
)
PORTB
=
PORTB
<<
1
+
1
;
if
(
PORTD
!=
0
b11111111
)
PORTD
=
(
PORTD
<<
1
)
+
1
;
_delay_ms
(
1000
);
else
{
if
(
PORTB
!=
0
b11111111
)
PORTB
=
(
PORTB
<<
1
)
+
1
;
else
on
=
1
;
}
_delay_ms
(
250
);
}
while
(
on
){
if
(
PORTB
!=
0
b00000000
)
PORTB
=
(
PORTB
-
1
)
>>
1
;
else
{
if
(
PORTD
!=
0
b00000011
)
PORTD
=
(
PORTD
-
1
)
>>
1
;
else
on
=
0
;
}
_delay_ms
(
250
);
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment