Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:594954546595
- Parent:
- 2:2992ec32f76f
- Child:
- 4:f8f17d0b7975
--- a/main.cpp Mon Apr 26 14:31:32 2021 +0000
+++ b/main.cpp Mon Apr 26 14:44:12 2021 +0000
@@ -1,16 +1,28 @@
-// EXERCICE N°2 : CHANGEMENT DE COULEUR DE LA LED EN FONCTION DE LA POSITION DU POTENTIOMETRE.
+// EXERCICE N°3 : CHANGEMENT DE COULEUR DE LA LED EN FONCTION DE LA POSITION DU POTENTIOMETRE (composer seulement de condition "if").
// Diagrame :
-// START
-// |<-----------------------|
-// valA2 = lire A2 |
-// | |
-// |- if valA2<0.15 o-| |
-// | | |
-// VERT |- if valA2<0.3 o-| |
-// | | | |
-// | BLEU ROUGE |
-// | | | |
-// ----------------------------------|
+// START
+// |<------------|
+// valA2 = lire A2 |
+// | |
+// |- if valA2<0.15 o-| |
+// | | |
+// VERT | |
+// | | |
+// ---------|---------| |
+// | |
+// |- if 0.15<valA2<0.3 o--| |
+// | | |
+// BLEU | |
+// | | |
+// ------------------------| |
+// | |
+// |- if 0.3<valA2 o--| |
+// | | |
+// ROUGE | |
+// | | |
+// |------------------| |
+// | |
+// ------------- |
#include "mbed.h"
enum COULEUR{
@@ -39,10 +51,10 @@
if(valA2<0.15) {
leds.write(VERT);
}
- else if(valA2<0.3) {
+ if(valA2>0.15 && valA2<0.3) {
leds.write(BLEU);
}
- else {
+ if(valA2>0.3) {
leds.write(ROUGE);
}
// Fin algo.