Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
khomiAuto
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
launchy
khomiAuto
Commits
35b967f9
Commit
35b967f9
authored
Jul 13, 2018
by
Mamadou diallo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout de l'ecran et de l'encodeur
parent
d03a0085
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
10 deletions
+78
-10
Khomi-auto-3.ino
Khomi-auto-3.ino
+78
-10
No files found.
Khomi-auto-3.ino
View file @
35b967f9
...
...
@@ -14,6 +14,15 @@
//Déclaration des variables du programme
int
valeur_hum_sol
=
0
;
// on stocke les valeurs lu par le capteur d'humidité sol
int
heure
=
0
;
int
minut
=
0
;
int
Switch
=
10
;
//switch boutton poussoir encoder
byte
portA
=
11
;
//encoder invertion fritzing 6
byte
portB
=
9
;
// encoder
byte
etat
=
0
;
bool
etat_switch
=
false
;
RTC_DS1307
rtc
;
char
daysOfTheWeek
[
7
][
12
]
=
{
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
};
...
...
@@ -29,12 +38,22 @@ void setup ()
lcd
.
begin
(
16
,
2
);
// for 16 x 2 LCD module
lcd
.
setBacklightPin
(
3
,
POSITIVE
);
lcd
.
setBacklight
(
HIGH
);
lcd
.
clear
();
lcd
.
setCursor
(
3
,
0
);
lcd
.
print
(
"KHomiAuto"
);
delay
(
1000
);
lcd
.
clear
();
pinMode
(
capteur_hum_sol
,
INPUT
);
pinMode
(
capteur_reservoir
,
INPUT
);
pinMode
(
portA
,
INPUT
);
pinMode
(
portB
,
INPUT
);
pinMode
(
Switch
,
INPUT_PULLUP
);
pinMode
(
pin_hum_sol
,
OUTPUT
);
pinMode
(
pompe
,
OUTPUT
);
pinMode
(
electrovanne
,
OUTPUT
);
attachInterrupt
(
0
,
control
,
CHANGE
);
attachInterrupt
(
1
,
control
,
CHANGE
);
////////////////////////////////////// configuration de l'horloge //////////////////////////////////////
if
(
!
rtc
.
begin
())
...
...
@@ -59,7 +78,10 @@ void loop ()
// on lit l'heure sur le rtc
DateTime
now
=
rtc
.
now
();
//on lance le debug pour verifier si il ya pas de probleme
Debug
();
//Debug();
control
();
affiche_lcd
();
//on test si il est heure d'arroser
...
...
@@ -110,21 +132,64 @@ void arroser () {
}
}
////////////////////////////////////// Débug //////////////////////////////////////
void
control
()
{
etat
=
etat
<<
1
|
digitalRead
(
portA
);
etat
=
etat
<<
1
|
digitalRead
(
portB
);
byte
etat_test
=
(
etat
|
B11110000
)
-
B11110000
;
//test des 4 bits de poids faible
//Serial.println(etat_test,BIN);//débug : visualisation de la séquence
//bouton poussoir
if
(
digitalRead
(
Switch
)
==
false
)
{
etat_switch
=
!
etat_switch
;
}
if
(
etat_test
==
B0111
)
{
heure
++
;
}
else
if
(
etat_test
==
B1011
)
{
heure
--
;
if
(
heure
<
0
)
{
heure
=
00
;
}
}
else
if
(
heure
==
25
)
{
heure
=
00
;
}
else
if
(
minut
==
61
)
{
minut
==
00
;
}
}
////////////////////////////////////// fonction affichage //////////////////////////////////////
void
affiche_lcd
()
{
DateTime
now
=
rtc
.
now
();
lcd
.
home
();
// set cursor to 0,0
lcd
.
print
(
now
.
hour
());
lcd
.
print
(
':'
);
lcd
.
print
(
now
.
minute
());
lcd
.
print
(
':'
);
lcd
.
print
(
now
.
second
());
lcd
.
print
(
" "
);
lcd
.
clear
();
lcd
.
setCursor
(
0
,
0
);
lcd
.
print
(
"H="
);
lcd
.
print
(
heure
);
lcd
.
setCursor
(
7
,
0
);
lcd
.
print
(
"M="
);
lcd
.
print
(
minut
);
lcd
.
setCursor
(
2
,
1
);
lcd
.
println
(
etat_switch
);
}
////////////////////////////////////// Débug //////////////////////////////////////
void
Debug
()
{
DateTime
now
=
rtc
.
now
();
...
...
@@ -145,7 +210,10 @@ void Debug()
Serial
.
print
(
now
.
year
());
Serial
.
print
(
" valeur humidite sol "
);
Serial
.
println
(
valeur_hum_sol
);
Serial
.
print
(
valeur_hum_sol
);
Serial
.
print
(
" heure "
);
Serial
.
println
(
heure
);
delay
(
1000
);
}
...
...
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