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: BLE_API mbed nRF51822
Revision 13:64601d952fe4, committed 2017-09-24
- Comitter:
- electronichamsters
- Date:
- Sun Sep 24 06:42:25 2017 +0000
- Parent:
- 12:45c2bb8231bf
- Commit message:
- tested. works
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Sep 24 06:18:49 2017 +0000
+++ b/main.cpp Sun Sep 24 06:42:25 2017 +0000
@@ -47,6 +47,8 @@
Si7021 tempI2C(p9, p11); //sda=p0.9, scl=p.11, for bart boards
//Si7021 tempI2C(p0, p1); //sda=p0.0, scl=p0.1
+DigitalOut sensorPwr(p0); //digital output on P0.00, for light sensor, bart board
+
//depending on how many sensor values you have, change this and examine Flag_Update_ADV_01
const uint8_t Max_Sensor_Num = 3; //set to the number of advertisements (temp, humidity, lumins = 3)
@@ -506,6 +508,7 @@
//convert battery voltage float value to string reprsentation to 2 decimal places, and save the size of string.
total_chars = sprintf (bat_volt_char, "%.2f", bat_reading);
+ sensorPwr = 1; //turn on power to light sensor
//read and convert analog voltage. Comment out this section if note needed, saves some battery
NRF_ADC->TASKS_STOP = 1;
float analogreading;
@@ -522,6 +525,7 @@
NRF_ADC->TASKS_STOP = 1;
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled; //disable to shutdown ADC & lower bat consumption
+ sensorPwr = 0; //turn off power to light sensor
//read temperature of Si7021
tempI2C.measure();