This program is given as a sample exercise. It has all the functionality to be used on a BLE Nano device and to connect to SimpleChat application for Android/ iOS from RebBearLab. The aim of the exercise is to read a voltage and then to convert as good as possible the appropriate temperature in Celsius degrees. AI5 pin is considered for reading the voltage for the termistor. The ADC of AI5 is called every second. The function to be updated : update_measurements() from main.cpp file.
Dependencies: BLE_API mbed nRF51822
Fork of nRF51822_DataLogger_with_Chat by
Diff: myFunctions.cpp
- Revision:
- 12:7772974713ac
- Parent:
- 11:baafa4f7a15e
diff -r baafa4f7a15e -r 7772974713ac myFunctions.cpp --- a/myFunctions.cpp Fri May 06 18:14:18 2016 +0000 +++ b/myFunctions.cpp Sat Oct 08 10:30:15 2016 +0000 @@ -65,9 +65,15 @@ } myDateTimeVar->newDateTime.hours = (myDateTimeVar->currentDateTime.hours + (tseconds / 3600+myDateTimeVar->newDateTime.minutes/60))%24; if (myDateTimeVar->newDateTime.hours < myDateTimeVar->currentDateTime.hours){ - myDateTimeVar->newDateTime.day = (myDateTimeVar->currentDateTime.day + 1)%(eNrDaysPerMonth[myDateTimeVar->currentDateTime.month+1]+1); + myDateTimeVar->newDateTime.day = (myDateTimeVar->currentDateTime.day + 1)%(eNrDaysPerMonth[myDateTimeVar->currentDateTime.month-1]+1); + if (myDateTimeVar->newDateTime.day == 0){ + myDateTimeVar->newDateTime.day ++; + } if (myDateTimeVar->newDateTime.day < myDateTimeVar->currentDateTime.day ){ - myDateTimeVar->newDateTime.month = (myDateTimeVar->currentDateTime.month+ 1)%13+1; + myDateTimeVar->newDateTime.month = (myDateTimeVar->currentDateTime.month+ 1)%13; + if (myDateTimeVar->newDateTime.month ==0){ + myDateTimeVar->newDateTime.month++; + } if (myDateTimeVar->newDateTime.month< myDateTimeVar->currentDateTime.month){ myDateTimeVar->newDateTime.year = (myDateTimeVar->currentDateTime.year+ 1); }