⚲
Projet
Général
Profil
Connexion
Accueil
Projets
Aide
Recherche
:
ssl
Tous les projets
Projets du Fablab
»
ssl
Aperçu
Activité
Documents
Wiki
Fichiers
Télécharger (923 octets)
Code Arduino
» temp_rature.ino
Clémence Tilhet
, 07/07/2021 17:10
#include
<LiquidCrystal_I2C.h>
#include
<Wire.h>
LiquidCrystal_I2C
lcd
(
0x27
,
20
,
4
);
int
reception
;
String
commande
=
""
;
int
pin
=
9
;
char
serialData
;
void
setup
()
{
pinMode
(
A0
,
OUTPUT
);
pinMode
(
pin
,
OUTPUT
);
Serial
.
begin
(
9600
);
Serial
.
flush
();
lcd
.
init
();
}
void
loop
()
{
// put your main code here, to run repeatedly:
int
valeur
=
analogRead
(
A0
)
;
float
temperature
=
valeur
*
(
5.0
/
1023.0
*
100.0
);
lcd
.
backlight
();
lcd
.
setCursor
(
0
,
0
);
lcd
.
print
(
temperature
);
Serial
.
println
(
temperature
);
while
(
Serial
.
available
()
>
0
)
{
reception
=
Serial
.
read
();
commande
+=
char
(
reception
);
delay
(
5
);
}
int
seuil
=
25
;
}
void
temp
()
{
if
(
Serial
.
available
()
>
0
){
serialData
=
Serial
.
read
();
Serial
.
print
(
serialData
);
if
(
serialData
==
'1'
){
digitalWrite
(
pin
,
HIGH
);
}
else
if
(
serialData
==
'0'
){
digitalWrite
(
pin
,
LOW
);
}
}
}
(1-1/1)
Chargement...