Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Hideaki Tai
/
omni_main
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
2c81ce37
authored
Feb 06, 2019
by
Hideaki Tai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LED indicator
parent
0f5b5594
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
include/global.h
+2
-0
include/main.h
+5
-0
src/main.cpp
+11
-0
No files found.
include/global.h
View file @
2c81ce37
...
...
@@ -33,4 +33,6 @@ struct XBeeSettings
};
XBeeSettings
xb_settings
[
6
];
static
constexpr
uint32_t
INDICATOR_INTERVAL_MS
=
1000
;
#endif // WHILL_GLOBAL_H
include/main.h
View file @
2c81ce37
...
...
@@ -289,6 +289,7 @@ void sendStatus()
{
if
(
b_streaming
)
{
Serial
.
println
(
"streaming enabled"
);
if
(
b_motor_active
)
packer
.
pack
(
HARDWARE_ID
,
whill
.
battery
(
WhillOmni
::
LR
::
L
),
whill
.
battery
(
WhillOmni
::
LR
::
R
),
whill
.
errorCode
(
WhillOmni
::
LR
::
L
),
whill
.
errorCode
(
WhillOmni
::
LR
::
R
));
else
...
...
@@ -296,6 +297,10 @@ void sendStatus()
XBEE_SERIAL
.
write
(
packer
.
data
(),
packer
.
size
());
}
else
{
Serial
.
println
(
"streaming disabled"
);
}
}
void
waitReply
(
uint16_t
wait_ms
=
0
)
...
...
src/main.cpp
View file @
2c81ce37
...
...
@@ -41,6 +41,7 @@ void setup()
pinMode
(
PIN_IRLED_OE
,
OUTPUT
);
digitalWrite
(
PIN_IRLED_OE
,
LOW
);
// Output Enable
pinMode
(
LED_BUILTIN
,
OUTPUT
);
WHILL_SERIAL_L
.
begin
(
WHILL_SERIAL_BAUD
,
SERIAL_8N2
);
// L
WHILL_SERIAL_R
.
begin
(
WHILL_SERIAL_BAUD
,
SERIAL_8N2
);
// R
...
...
@@ -94,7 +95,17 @@ void loop()
static
uint32_t
prev_ms
=
millis
();
if
((
millis
()
-
prev_ms
)
>
streaming_interval
)
{
Serial
.
println
(
"send status"
);
sendStatus
();
prev_ms
=
millis
();
}
static
uint32_t
prev_indicate
=
millis
();
static
bool
led_state
=
false
;
if
((
millis
()
-
prev_indicate
)
>
INDICATOR_INTERVAL_MS
)
{
digitalWrite
(
LED_BUILTIN
,
led_state
);
led_state
=
!
led_state
;
prev_indicate
=
millis
();
}
}
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