Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scripts-perso
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daniel Stan
scripts-perso
Commits
76d8a358
Commit
76d8a358
authored
Feb 20, 2017
by
Daniel STAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lotus: some debug and fixes
parent
e36fca84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
arduino/lotus/lotus.ino
arduino/lotus/lotus.ino
+12
-7
No files found.
arduino/lotus/lotus.ino
View file @
76d8a358
...
...
@@ -11,8 +11,8 @@
#define PIN_POS A0
// Position hautes et basses
#define POS_HIGH 2
80
#define POS_LOW 10
7
#define POS_HIGH 2
75
#define POS_LOW 10
5
#define BOUNCE 3
void
setup
()
...
...
@@ -38,7 +38,7 @@ void move(bool going_up, int target=0, int timeout=0) {
int
val
;
if
(
target
)
{
target
=
min
(
max
(
target
,
POS_LOW
),
POS_HIGH
);
going_up
=
target
<
get_position
()
;
going_up
=
get_position
()
<
target
;
}
Serial
.
print
(
"Move:"
);
Serial
.
print
(
going_up
?
"Up"
:
"Down"
);
...
...
@@ -48,12 +48,10 @@ void move(bool going_up, int target=0, int timeout=0) {
Serial
.
println
(
timeout
);
if
(
going_up
)
{
comp
=
1
;
target
=
POS_HIGH
;
digitalWrite
(
RF_M_DRV1
,
HIGH
);
digitalWrite
(
RF_M_DRV2
,
LOW
);
}
else
{
comp
=-
1
;
target
=
POS_LOW
;
digitalWrite
(
RF_M_DRV1
,
LOW
);
digitalWrite
(
RF_M_DRV2
,
HIGH
);
}
...
...
@@ -62,8 +60,15 @@ void move(bool going_up, int target=0, int timeout=0) {
do
{
delay
(
1
);
val
=
get_position
();
}
while
(
val
*
comp
<
target
*
comp
);
Serial
.
print
(
"Endmove:"
);
Serial
.
print
(
val
);
Serial
.
print
(
","
);
Serial
.
print
(
comp
);
Serial
.
print
(
","
);
Serial
.
println
(
target
);
report_pos
();
}
if
(
timeout
)
...
...
@@ -99,10 +104,10 @@ void loop() {
move
(
true
,
0
,
500
);
break
;
case
'U'
:
move
(
fals
e
,
1024
);
move
(
tru
e
,
1024
);
break
;
case
'D'
:
move
(
true
,
0
);
move
(
false
,
1
);
break
;
case
'm'
:
move
(
false
,
Serial
.
parseInt
());
...
...
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