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
9f2e747c
Commit
9f2e747c
authored
Jan 18, 2017
by
Daniel STAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
màj lotus
parent
c096c40c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
10 deletions
+36
-10
arduino/lotus/lotus.ino
arduino/lotus/lotus.ino
+36
-10
No files found.
arduino/lotus/lotus.ino
View file @
9f2e747c
...
...
@@ -5,15 +5,15 @@ avec programme python coté port série*/
//#define RECV_PIN 13
#define RECV_PIN A2
// Pin du moteur
#define RF_M_CONT 10
#define RF_M_DRV1 11
#define RF_M_DRV2 12
#define RF_M_CONT 1
2 //EN 3,4, ex 1
0
#define RF_M_DRV1 11
//3A
#define RF_M_DRV2 1
0 //4A, ex 1
2
#define PIN_POS A0
#define POS_HIGH 2
62
#define POS_LOW 10
5
#define BOUNCE
20
#define POS_HIGH 2
80
#define POS_LOW 10
7
#define BOUNCE
3
#include <IRLib.h>
#include "remote.h"
...
...
@@ -42,24 +42,50 @@ void setup()
}
void
move
(
bool
going_up
)
{
int
target
;
int
comp
;
int
val
;
if
(
going_up
)
{
comp
=
1
;
target
=
POS_HIGH
;
Serial
.
println
(
"Going up"
);
digitalWrite
(
RF_M_DRV1
,
HIGH
);
digitalWrite
(
RF_M_DRV2
,
LOW
);
}
else
{
comp
=-
1
;
target
=
POS_LOW
;
Serial
.
println
(
"Going down"
);
digitalWrite
(
RF_M_DRV1
,
LOW
);
digitalWrite
(
RF_M_DRV2
,
HIGH
);
}
digitalWrite
(
RF_M_CONT
,
HIGH
);
delay
(
300
);
if
(
!
going_up
)
delay
(
200
);
delay
(
1
);
while
((
val
=
analogRead
(
PIN_POS
)
*
comp
)
<
target
*
comp
)
{
if
(
My_Receiver
.
GetResults
(
&
My_Decoder
))
{
My_Receiver
.
resume
();
if
(
My_Decoder
.
decode
()
==
BTN_STOP
)
{
Serial
.
println
(
"Manual stop"
);
break
;
}
}
delay
(
1
);
}
Serial
.
print
(
"Stopping because"
);
Serial
.
println
(
val
);
report_pos
();
/*delay(300);
if(going_up)
delay(200);*/
digitalWrite
(
RF_M_CONT
,
LOW
);
digitalWrite
(
RF_M_DRV1
,
LOW
);
digitalWrite
(
RF_M_DRV2
,
LOW
);
}
void
report_pos
()
{
Serial
.
println
(
"Report"
);
Serial
.
println
(
analogRead
(
PIN_POS
));
}
void
loop
()
{
int
val
;
...
...
@@ -95,7 +121,7 @@ void loop() {
digitalWrite
(
RF_M_DRV1
,
HIGH
);
digitalWrite
(
RF_M_DRV2
,
LOW
);
}
else
if
(
incomingByte
==
'r'
)
{
Serial
.
println
(
analogRead
(
PIN_POS
)
);
report_pos
(
);
}
}
if
(
My_Receiver
.
GetResults
(
&
My_Decoder
))
{
...
...
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