Noah Proust / Mbed OS centrale_alarme_v1

Dependencies:   C12832

Files at this revision

API Documentation at this revision

Comitter:
arkadia
Date:
Tue Jun 08 06:58:02 2021 +0000
Commit message:
noah

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
C12832.lib Show annotated file Show diff for this revision Revisions of this file
clign_led.h Show annotated file Show diff for this revision Revisions of this file
etat.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /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*
--- /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
--- /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
--- /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
--- /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);
+        }
+    }
+
+}
--- /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