Noah Proust
/
centrale_alarme_v1
vh
Revision 0:d7df74440bf6, committed 2021-06-08
- Comitter:
- arkadia
- Date:
- Tue Jun 08 06:58:02 2021 +0000
- Commit message:
- noah
Changed in this revision
diff -r 000000000000 -r d7df74440bf6 .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Tue Jun 08 06:58:02 2021 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
diff -r 000000000000 -r d7df74440bf6 C12832.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Tue Jun 08 06:58:02 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
diff -r 000000000000 -r d7df74440bf6 clign_led.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clign_led.h Tue Jun 08 06:58:02 2021 +0000 @@ -0,0 +1,2 @@ +#ifndef clign_led.h +#define clign_led.h \ No newline at end of file
diff -r 000000000000 -r d7df74440bf6 etat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etat.h Tue Jun 08 06:58:02 2021 +0000 @@ -0,0 +1,17 @@ +#ifndef etat.h +#define etat.h + +/* fonction qui traite les entrees + en entree : valeur de lentree + en sortie : etat entree + Cc : Court circuit + An : Anomalie + Nl : normal + Cp : cable coupoe */ +#define Cc 0 +#define An 1 +#define Nl 2 +#define Cp 3 + + +#endif
diff -r 000000000000 -r d7df74440bf6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 08 06:58:02 2021 +0000 @@ -0,0 +1,78 @@ +/* Programme centrale d'alarme + V1_0 + Le 16/12/2020 + Par Simon Delcroix */ +// On ajoute entree 1 + +#include "mbed.h" +#include "platform/mbed_thread.h" +#include "C12832.h" + +// Blinking rate in milliseconds +#define BLINKING_RATE_MS 500 +Serial pc(USBTX,USBRX); +AnalogIn pot1 (A0); +C12832 lcd(D11, D13, D12, D7, D10); +/* fonction qui traite les entrees + en entree : valeur de l'entree + en sortie : etat entree + Cc : Court circuit + An : Anomalie + Nl : normal + Cp : cable coupoe */ + +#define VNl 1.41 // en dessous pas anomalie +#define VAn 0.88 // en dessous Anomalie +#define VCc 0.36 // en dessous cable cc +// au dessus de VNl Cable coupe +int resultat; +PwmOut led (D5); +PwmOut spkr(D6); + +int main() +{ + while(true) { + float Entree1; + float cc = 200; + float an = 500; + float cp = 800; + Entree1 = 5*pot1.read(); + + pc.printf("Entree 1 =%f\n\r",Entree1); + if (Entree1 < VCc) { + lcd.locate(0, 3); + lcd.printf("Entree 1 : Court circuit"); + led.write(0.15); + led.period(1); + spkr.period(1.0/cc); + spkr=0.5; + thread_sleep_for(0.2); + + } else if (Entree1 < VAn) { + lcd.locate(0, 3); + lcd.printf("Entree 1 : Anomalie "); + led.write(0.05); + led.period(1); + spkr.period(1.0/an); + spkr=0.5; + thread_sleep_for(0.2); + + } else if (Entree1 < VNl) { + lcd.locate(0, 3); + lcd.printf("Entree 1 : Etat normal "); + led.write(1); + led.period(1); + spkr=0.0; + + } else { + lcd.locate(0, 3); + lcd.printf("Entree 1 : Cable coupe "); + led.write(0.1); + led.period(1); + spkr.period(1.0/cp); + spkr=0.5; + thread_sleep_for(0.2); + } + } + +}
diff -r 000000000000 -r d7df74440bf6 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Jun 08 06:58:02 2021 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9