Anderson Cunha / Mbed OS example_smart-grid

Dependencies:   sgam-lib

Files at this revision

API Documentation at this revision

Comitter:
AndersonIctus
Date:
Mon Jun 03 23:34:18 2019 -0300
Parent:
14:85442510347c
Child:
16:22ed771ebe4c
Commit message:
- Mudan?as para ler um metodo a partir de um ticker
=> proximo passo ? setar diretamente o contador !

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
sgam-lib.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Jun 02 19:53:54 2019 +0000
+++ b/main.cpp	Mon Jun 03 23:34:18 2019 -0300
@@ -1,19 +1,17 @@
 #include "mbed.h"
-#include "Event.h"
-
 #include "Temperature.h"
-#include "Gyroscope.h"
+// #include "Gyroscope.h"
 
 Serial pc(USBTX, USBRX);        // SAIDA SERIAL PADRÃO
 
-// LEDs para serem acesas 
-DigitalOut led1 (LED1);         // LED 1 de 3 DO BOARD
-DigitalOut led_dig(D6);         // LED 1 da porta Digital 6 (A placa tem D6 e D8)
-
 Temperature temp (A1); // Instancia de Temperatura
 
-I2C    i2c(I2C_SDA, I2C_SCL);       // PORTA I2C
-Gyroscope giro(i2c); // Instancia do Giroscopio
+// I2C    i2c(I2C_SDA, I2C_SCL);       // PORTA I2C
+// Gyroscope giro(i2c); // Instancia do Giroscopio
+
+// LEDs para serem acesas 
+// DigitalOut led1 (LED1);         // LED 1 de 3 DO BOARD
+// DigitalOut led_dig(D6);         // LED 1 da porta Digital 6 (A placa tem D6 e D8)
 
 // FILAS PARA EVENTOS
 EventQueue eventQueue1;
@@ -21,13 +19,13 @@
 
 // --------------------------------------------------------------------------------- //
 void fazLeituraTemperatura() {
-    printf("** Temperatura => %02.02f", *(temp.getValue()) );
+    pc.printf("** Temperatura => %02.02f\r\n", temp.getValue() );
 }
 
-void fazLeituraGyroscopio() {
-    GyroscopeData* data = giro.getValue();
-    printf("*** (g_x = %03d; g_y = %03d; g_z = %03d)       ***\r\n", data->gx, data->gy, data->gz);
-}
+// void fazLeituraGyroscopio() {
+//     GyroscopeData* data = giro.getValue();
+//     printf("*** (g_x = %03d; g_y = %03d; g_z = %03d)       ***\r\n", data->gx, data->gy, data->gz);
+// }
 
 // --------------------------------------------------------------------------------- //
 int main() {
@@ -39,13 +37,13 @@
     eventThread.start( callback(&eventQueue1, &EventQueue::dispatch_forever) );
  
     Ticker ledTicker;
-    ledTicker.attach(eventQueue1.event(&fazLeituraTemperatura), 5.0f);
+    ledTicker.attach(eventQueue1.event(&fazLeituraTemperatura), 3.0f);
 
     // 2 - Verificar se houve alguma mudança no Giroscópio
     // Thread eventThread_2(osPriorityNormal);
     // eventThread_2.start( callback(&eventQueue2, &EventQueue::dispatch_forever) );
 
-
+    // fazLeituraTemperatura();
     printf("!!!FIM DE INICIALIZACAO!!!\r\n");
     wait(osWaitForever);
 }
--- a/sgam-lib.lib	Sun Jun 02 19:53:54 2019 +0000
+++ b/sgam-lib.lib	Mon Jun 03 23:34:18 2019 -0300
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/AndersonIctus/code/sgam-lib/#f998244e9f80
+https://os.mbed.com/users/AndersonIctus/code/sgam-lib/#f21aab30658a