Repositório para o trabalho semestral (Projeto Estufa) de Microcontroladores.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
plcpinho
Date:
Mon Jun 25 16:30:39 2018 +0000
Parent:
7:4f1f3a081890
Commit message:
Projeto Finalizado

Changed in this revision

BME280.lib 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
MFRC522.lib Show annotated file Show diff for this revision Revisions of this file
projeto_final/main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4f1f3a081890 -r 821e3ed311d0 BME280.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BME280.lib	Mon Jun 25 16:30:39 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/MACRUM/code/BME280/#c1f1647004c4
diff -r 4f1f3a081890 -r 821e3ed311d0 C12832.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Mon Jun 25 16:30:39 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/askksa12543/code/C12832/#990d5eec2ef6
diff -r 4f1f3a081890 -r 821e3ed311d0 MFRC522.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MFRC522.lib	Mon Jun 25 16:30:39 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/AtomX/code/MFRC522/#63d729186747
diff -r 4f1f3a081890 -r 821e3ed311d0 projeto_final/main.cpp
--- a/projeto_final/main.cpp	Sun Jun 24 22:13:06 2018 +0000
+++ b/projeto_final/main.cpp	Mon Jun 25 16:30:39 2018 +0000
@@ -34,6 +34,8 @@
 // Controle manual da bomba
 int controleManual = 0;
 
+// Variavel intervalo de tempo da bomba
+float tempoBomba = 2.0;
 
 // Definição dos protótipos
 void controleAutomatico();
@@ -62,9 +64,8 @@
         controleManual = 0;
         controleAutomatico();
         controleReconexao = 1;
-    } 
-    else {
-        if (controleReconexao){
+    } else {
+        if (controleReconexao) {
             wait(2.0f);
             bluetooth.printf("\n\nBem vindo ao sistema de controle da estufa.\nPara acessar as configuracoes, identifique-se.\n\n");
             controleReconexao = 0;
@@ -85,11 +86,12 @@
 // Função de exibição dos sensores
 void exibirInfo()
 {
+    tempoBomba = 0.0f;
     int aux = 1;
     char sair;
     bluetooth.printf("Exibindo informacoes. 'S' para sair.\n");
     while (aux && autenticado) {
-        bluetooth.printf("%2.2f C, %04.2f hPa, Umidade: %3.3f%%\n\n", sensor_t_p.getTemperature(), sensor_t_p.getPressure(), ((1-sensor_u.read()) * 100.0f)/0.6);
+        bluetooth.printf("Temperatura: %2.2f C\nPressao: %04.2f hPa\nUmidade: %3.3f%%\n\n", sensor_t_p.getTemperature(), sensor_t_p.getPressure(), ((1-sensor_u.read()) * 100.0f)/0.7);
         controleAutomatico();
         conexaoBluetooth();
 
@@ -97,6 +99,7 @@
             sair = bluetooth.getc();
             if (sair == 'S' || sair == 's') {
                 bluetooth.printf("Rotina cancelada.\n");
+                tempoBomba = 2.0f;
                 aux = 0;
                 exibirMenu();
                 continue;
@@ -111,10 +114,13 @@
 {
     if (!controleManual) {
         if (((1-sensor_u.read()) * 100.0f)/0.6 < 20.0) {
-            bomba.write(0.2f);
+            bomba.write(1.0f);
+            wait(0.5f);
+            bomba.write(0.0f);
+            wait(tempoBomba);
         }
 
-        if (((1-sensor_u.read()) * 100.0f)/0.6 > 40.0) {
+        if (((1-sensor_u.read()) * 100.0f)/0.6 > 30.0) {
             bomba.write(0.0f);
         }
     }
@@ -153,7 +159,7 @@
 
                         case 'L':
                         case 'l':
-                            bomba.write(0.2f);
+                            bomba.write(1.0f);
                             bluetooth.printf("Bomba acionada.\n");
                             controleManual = 1;
                             wait(1.0f);
@@ -195,7 +201,7 @@
         }
 
         autenticado = 1;
-        
+
         flushSerialBuffer();
 
         bluetooth.printf("Card reconhecido, acesso concedido.\n\n");