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.
Revision 22:f3af2192b3ff, committed 2019-07-11
- Comitter:
- brunnobbco
- Date:
- Thu Jul 11 13:13:06 2019 +0000
- Parent:
- 21:6cf50085f9f3
- Commit message:
- Com envio de codigo do sensor
Changed in this revision
| source/main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/main.cpp Wed Jul 10 17:55:38 2019 +0000
+++ b/source/main.cpp Thu Jul 11 13:13:06 2019 +0000
@@ -251,15 +251,19 @@
*/
void increment_count(void)
{
- uint8_t count = 0;
-
+ uint8_t count =0;
+ float float32;
+ uint8_t count_v[4];
+ uint8_t *vp;
+ uint8_t temp;
+
ble_error_t err = _count_char.get(*_server, count);
if (err) {
printf("read of the count value returned error %u\r\n", err);
return;
}
- //count ++;
+ // count ++;
if (sensor_light.open()) {
@@ -269,7 +273,16 @@
//Print the current UV index
printf("UV index = %.3f\n", (float)sensor_light.get_uv_index());
//Sleep for 0.5 seconds
- count= (uint8_t)sensor_light.get_light_level();
+ float32= sensor_light.get_light_level();
+ count = (uint8_t)float32;
+ //printf("Lux = %.2f\n", float32);
+ vp = (uint8_t*)&float32;
+ count_v[0] = vp[0];
+ count_v[1] = vp[1];
+ count_v[2] = vp[2];
+ count_v[3] = vp[3];
+ *(float*)count_v = float32;
+ count = count_v[2];
_actuated_led = !_actuated_led;
}