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
9766db4a
authored
Dec 01, 2018
by
Hideaki Tai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add debouncer
parent
e23c0937
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
include/main.h
+2
-0
src/main.cpp
+14
-3
No files found.
include/main.h
View file @
9766db4a
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <MPU9250.h>
#include <MPU9250.h>
#include <PCA9624.h>
#include <PCA9624.h>
#include <RzmEepromMap.h>
#include <RzmEepromMap.h>
#include <Bounce2.h>
using
namespace
Whill
;
using
namespace
Whill
;
...
@@ -22,6 +23,7 @@ PCA9624 irled(0x60);
...
@@ -22,6 +23,7 @@ PCA9624 irled(0x60);
RzmEepromMap
eepmap
;
RzmEepromMap
eepmap
;
StopWatch
stopwatch
;
StopWatch
stopwatch
;
FrameRateCounter
fps
(
30
);
FrameRateCounter
fps
(
30
);
Bounce
emergency_debouncer
;
void
printSpeedProfile
(
WhillOmni
::
LR
lr
)
void
printSpeedProfile
(
WhillOmni
::
LR
lr
)
{
{
...
...
src/main.cpp
View file @
9766db4a
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
#include "global.h"
#include "global.h"
#include "main.h"
#include "main.h"
void
disableMotor
()
{
b_motor_active
=
false
;
}
void
setup
()
void
setup
()
{
{
Serial
.
begin
(
115200
);
Serial
.
begin
(
115200
);
...
@@ -27,6 +25,8 @@ void setup()
...
@@ -27,6 +25,8 @@ void setup()
// ----- Emergency Switch -----
// ----- Emergency Switch -----
pinMode
(
PIN_EMERGENCY
,
INPUT
);
pinMode
(
PIN_EMERGENCY
,
INPUT
);
emergency_debouncer
.
attach
(
PIN_EMERGENCY
,
INPUT
);
emergency_debouncer
.
interval
(
200
);
// ----- check I2C -----
// ----- check I2C -----
Wire
.
begin
();
Wire
.
begin
();
...
@@ -67,7 +67,8 @@ void setup()
...
@@ -67,7 +67,8 @@ void setup()
whill
.
streaming
(
true
,
WHILL_INFO_INTERVAL_MS
,
DATASET
::
SENSOR_INFO
);
whill
.
streaming
(
true
,
WHILL_INFO_INTERVAL_MS
,
DATASET
::
SENSOR_INFO
);
delay
(
1000
);
delay
(
1000
);
attachInterrupt
(
digitalPinToInterrupt
(
PIN_EMERGENCY
),
disableMotor
,
RISING
);
if
(
digitalRead
(
PIN_EMERGENCY
)
==
LOW
)
b_motor_active
=
true
;
else
b_motor_active
=
false
;
Serial
.
println
(
"start program"
);
Serial
.
println
(
"start program"
);
fps
.
start
();
fps
.
start
();
...
@@ -76,6 +77,16 @@ void setup()
...
@@ -76,6 +77,16 @@ void setup()
void
loop
()
void
loop
()
{
{
emergency_debouncer
.
update
();
if
(
emergency_debouncer
.
rose
())
{
b_motor_active
=
false
;
}
if
(
emergency_debouncer
.
fell
())
{
b_motor_active
=
true
;
}
setVelocity
();
setVelocity
();
whill
.
parse
();
whill
.
parse
();
...
...
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