Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_IKS01A1 mbed-rtos mbed
Fork of HelloWorld_IKS01A1 by
mailBox.cpp
- Committer:
- nlsantos
- Date:
- 2016-05-04
- Revision:
- 12:7ef8061de189
- Child:
- 13:569b49092661
File content as of revision 12:7ef8061de189:
#include "mbed.h" #include "rtos.h" #include <logData.cpp> /* Mail typedef struct { float voltage; float current; uint32_t counter; } mail_t; */ //LogData mail_t Mail<LogData, 16> mail_box; void send_thread (void const *args) { while (true) { LogData *log = mail_box.alloc(); log->id = ; log->tempCelcius; log->tempFarenheit; log->humidity; log->pressure; log->accelerometer; log->gyroscope; log->magnetometer; log->dd; log->mm; log->yyyy; log->hh; log->min; log->ss; mail_box.put(log); Thread::wait(1000); } } int main (void) { Thread thread(send_thread); while (true) { 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); mail_box.free(mail); } } }