Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
boebot-public
/
eriala-2024
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2e543e87
authored
Sep 24, 2025
by
Risto Heinsar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added scheduler example using millis()
parent
deab1007
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
lab3/lab3_demo_scheduler_without_delay/lab3_demo_scheduler_without_delay.ino
lab3/lab3_demo_scheduler_without_delay/lab3_demo_scheduler_without_delay.ino
0 → 100644
View file @
2e543e87
const
unsigned
task1Period
=
500
;
/* iga 500 ms järel */
const
unsigned
task2Period
=
250
;
/* iga 100 ms järel */
void
setup
()
{
Serial
.
begin
(
9600
);
}
void
loop
()
{
static
uint32_t
task1LastRun
=
0
;
static
uint32_t
task2LastRun
=
0
;
uint32_t
currentTime
=
millis
();
/* Ülesannet lahendatakse iga 500 ms järel */
if
(
currentTime
-
task1LastRun
>=
task1Period
)
{
task1LastRun
=
currentTime
;
Serial
.
print
(
millis
()
/
(
float
)
1000
);
Serial
.
println
(
" Olen Boe-Bot"
);
}
/* Ülesannet lahendatakse iga 250 ms järel */
if
(
currentTime
-
task2LastRun
>=
task2Period
)
{
task2LastRun
=
currentTime
;
Serial
.
print
(
millis
()
/
(
float
)
1000
);
Serial
.
println
(
" Beep-Boop"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment