Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Astreos_Arduino
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hicham Brahimi
Astreos_Arduino
Commits
7fbe6d30
Commit
7fbe6d30
authored
6 years ago
by
hichbra
Browse files
Options
Downloads
Patches
Plain Diff
Ajout capteur temperature dans le programme de test
parent
d947fe05
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ASTREOS_SMP.ino
+30
-9
30 additions, 9 deletions
ASTREOS_SMP.ino
with
30 additions
and
9 deletions
ASTREOS_SMP.ino
+
30
−
9
View file @
7fbe6d30
#define PORT_HALL A0
#define PORT_FSR A2
#define PORT_TEMP A1
#define INTERVALLE 1000
unsigned
long
temps_precedent
;
//--------------------------------------------------
int
hallAnalogique
;
// La lecture analogique du gaussmetre
int
gauss
;
// Valeur convertie en gauss
...
...
@@ -10,10 +15,15 @@ int fsrVoltage; // La lecture analogique convertie en tension
unsigned
long
fsrResistance
;
// La tension convertie en resistance
unsigned
long
fsrConductance
;
long
newton
;
// La resistance convertie en force (Newton)
//--------------------------------------------------
int
tempAnalogique
;
// La lecture analogique du capteur de temperature
float
tempVoltage
;
// La lecture analogique convertie en tension
float
temperature
;
// Temperature
void
setup
(){
Serial
.
begin
(
9600
);
temps_precedent
=
millis
();
}
void
loop
(){
...
...
@@ -36,7 +46,7 @@ void loop(){
//Serial.print("Lecture de la tension en mV = "); Serial.println(fsrVoltage);
if
(
fsrVoltage
==
0
)
{
Serial
.
println
(
"Aucune pression"
);
//
Serial.println("Aucune pression");
newton
=
0
;
}
else
{
// La tension = Vcc * R / (R + FSR) où R = 10K et Vcc = 5V
...
...
@@ -55,16 +65,27 @@ void loop(){
//Serial.print("Force en Newtons: "); Serial.println(fsrForce);
}
// ------------------------------------- Lecture et calcul de la Température ----------------------------------------------
tempAnalogique
=
analogRead
(
PORT_TEMP
);
tempVoltage
=
(
tempAnalogique
/
1024.0
)
*
5.0
;
temperature
=
(
tempVoltage
-
0.5
)
*
100
;
// ------------------------------------- Affichage des résultats ----------------------------------------------
Serial
.
println
(
"---------------------------------------------------"
);
if
(
millis
()
-
temps_precedent
>=
INTERVALLE
)
{
Serial
.
println
(
"---------------------------------------------------"
);
// Affiche la valeur en Gauss
Serial
.
print
(
"=> champ magnétique = "
);
Serial
.
print
(
gauss
);
Serial
.
println
(
" Gauss"
);
// Affiche la valeur
en Gauss
Serial
.
print
(
"=>
champ magnét
ique = "
);
Serial
.
print
(
gauss
);
Serial
.
print
ln
(
"
Gauss"
);
// Affiche la
valeur du capteur de force (Tension/Newton)
Serial
.
print
(
"=>
Forc
e Analogique = "
);
Serial
.
print
(
fsr
Analogique
);
Serial
.
print
(
" ||
Force en Newtons
: "
);
Serial
.
println
(
newton
);
// Affiche la valeur
du capteur de force (Tension/Newton)
Serial
.
print
(
"=>
Force Analog
ique = "
);
Serial
.
print
(
fsrAnalogique
);
Serial
.
print
(
"
|| Force en Newtons: "
);
Serial
.
println
(
newton
);
// Affiche la
Température
Serial
.
print
(
"=>
Temperatur
e Analogique = "
);
Serial
.
print
(
temp
Analogique
);
Serial
.
print
(
" ||
Temperature
: "
);
Serial
.
println
(
temperature
);
// attendre 100 millisecondes
delay
(
1000
);
temps_precedent
=
millis
();
}
delay
(
50
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment