KEIS

Dependencies:   C12832_lcd mbed-rtos mbed

Fork of rtos_mail by mbed official

Revision:
4:4273c11c7ac1
Parent:
2:b84386915279
--- a/main.cpp	Tue Jun 04 16:02:29 2013 +0100
+++ b/main.cpp	Wed Sep 25 05:12:23 2013 +0000
@@ -1,23 +1,28 @@
 #include "mbed.h"
 #include "rtos.h"
+#include "C12832_lcd.h"
+
+C12832_LCD lcd;
 
 /* Mail */
 typedef struct {
-  float    voltage; /* AD result of measured voltage */
-  float    current; /* AD result of measured current */
-  uint32_t counter; /* A counter value               */
+  float    temp;
+  float    humid; 
+  float    illumi;
+  // uint32_t  count; 
 } mail_t;
 
 Mail<mail_t, 16> mail_box;
 
 void send_thread (void const *args) {
-    uint32_t i = 0;
+   uint32_t count= 0;
     while (true) {
-        i++; // fake data update
+        count++; // fake data update
         mail_t *mail = mail_box.alloc();
-        mail->voltage = (i * 0.1) * 33; 
-        mail->current = (i * 0.1) * 11;
-        mail->counter = i;
+        mail->temp = ( count * 0.1) * 30; 
+        mail->humid = (count * 0.1) * 50;
+        mail->illumi = (count * 0.1) * 50;
+       // mail->count = count;
         mail_box.put(mail);
         Thread::wait(1000);
     }
@@ -30,9 +35,10 @@
         osEvent evt = mail_box.get();
         if (evt.status == osEventMail) {
             mail_t *mail = (mail_t*)evt.value.p;
-            printf("\nVoltage: %.2f V\n\r"   , mail->voltage);
-            printf("Current: %.2f A\n\r"     , mail->current);
-            printf("Number of cycles: %u\n\r", mail->counter);
+            lcd.printf("temp: %.2f \n\r"   , mail->temp);
+            lcd.printf("humid: %.2f \n\r"     , mail->humid);
+            lcd.printf("illumination: %.2f \n\r"     , mail->illumi);
+           // lcd.printf("Number of cycles: %u\n\r", mail->counter);
             
             mail_box.free(mail);
         }