Andrew Reed
/
city1082-rtos-telemetry
City1082 telemetry application
src/sensors.cpp@8:254f53c47a2b, 2021-12-01 (annotated)
- Committer:
- reedas
- Date:
- Wed Dec 01 10:15:16 2021 +0000
- Revision:
- 8:254f53c47a2b
- Parent:
- 7:bb1bb2a54033
Added status led display thread
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
reedas | 4:455f43ddbaa9 | 1 | #include "mbed.h" |
reedas | 4:455f43ddbaa9 | 2 | #include "display.h" |
reedas | 5:74a28c49ec84 | 3 | #include <cmath> |
reedas | 4:455f43ddbaa9 | 4 | |
reedas | 4:455f43ddbaa9 | 5 | /* Send Thread */ |
reedas | 4:455f43ddbaa9 | 6 | |
reedas | 4:455f43ddbaa9 | 7 | void sendThread(void) |
reedas | 4:455f43ddbaa9 | 8 | { |
reedas | 7:bb1bb2a54033 | 9 | float temp; /* AD result of measured voltage */ |
reedas | 7:bb1bb2a54033 | 10 | float lightLev; /* AD result of measured current */ |
reedas | 7:bb1bb2a54033 | 11 | int cycles; /* A counter value */ |
reedas | 4:455f43ddbaa9 | 12 | uint32_t i = 0; |
reedas | 4:455f43ddbaa9 | 13 | while (true) { |
reedas | 4:455f43ddbaa9 | 14 | i++; // fake data update |
reedas | 7:bb1bb2a54033 | 15 | temp = fmod((i * 0.1f) * 3.3f, 40); |
reedas | 7:bb1bb2a54033 | 16 | lightLev = fmod((i * 0.1f) * 5.5f, 100); |
reedas | 7:bb1bb2a54033 | 17 | cycles = i; |
reedas | 7:bb1bb2a54033 | 18 | displaySendUpdateSensor(temp, lightLev, cycles); |
reedas | 4:455f43ddbaa9 | 19 | ThisThread::sleep_for(1s); |
reedas | 4:455f43ddbaa9 | 20 | } |
reedas | 4:455f43ddbaa9 | 21 | } |