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:
- stwykd
- Date:
- 2016-05-07
- Revision:
- 24:527fdf64cbb0
- Parent:
- 23:61e09468bf3d
- Child:
- 25:55c0dc5b32b3
File content as of revision 24:527fdf64cbb0:
#include "mbed.h" #include "rtos.h" #include <time.h> #include <main.cpp> class MailBox{ public: typedef struct { uint8_t id; float tempCelcius; float tempFarenheit; float humidity; float pressure; int accelerometer; int gyroscope; int magnetometer; char* date; } log_data; Mail<log_data, 120> mail_box; void send_thread (log_data newLog) { while (true) { log_data *log = mail_box.alloc(); log->tempCelcius = newLog.tempCelcius; log->tempFarenheit = newLog.tempFarenheit; log->humidity = newLog.humidity; log->pressure = newLog.pressure; log->accelerometer = newLog.accelerometer; log->gyroscope = newLog.gyroscope; log->magnetometer = newLog.magnetometer; //TODO I get a weird error because of include <main> //You need that to include t //Not solved it yet, but you can do it by moving t or something //For the date represetation, that statement does it log->date = asctime(&t); mail_box.put(log); Thread::wait(1000); } } };