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
myData.h@8:f28ad4600b0f, 2016-04-11 (annotated)
- Committer:
- tanasaro10
- Date:
- Mon Apr 11 17:21:14 2016 +0000
- Revision:
- 8:f28ad4600b0f
- Child:
- 9:303d3628986a
This build add some features:; -> for any message that starts with 'x' it is treated as command:; xtg: return time: HH:MM:SS; xdg: get date: 20XX:MM:DD; xtiHHMMSS : set the time; xdiYYMMDD: set date; etc.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tanasaro10 | 8:f28ad4600b0f | 1 | |
tanasaro10 | 8:f28ad4600b0f | 2 | typedef struct{ |
tanasaro10 | 8:f28ad4600b0f | 3 | uint8_t hour; |
tanasaro10 | 8:f28ad4600b0f | 4 | uint8_t min; |
tanasaro10 | 8:f28ad4600b0f | 5 | uint8_t sec; |
tanasaro10 | 8:f28ad4600b0f | 6 | } mtime_t; |
tanasaro10 | 8:f28ad4600b0f | 7 | |
tanasaro10 | 8:f28ad4600b0f | 8 | typedef struct{ |
tanasaro10 | 8:f28ad4600b0f | 9 | mtime_t currentTime; |
tanasaro10 | 8:f28ad4600b0f | 10 | mtime_t newTime; |
tanasaro10 | 8:f28ad4600b0f | 11 | bool updateTime; // true if currentTime needs to be updated with newTime; |
tanasaro10 | 8:f28ad4600b0f | 12 | } mtime_manager_t; |
tanasaro10 | 8:f28ad4600b0f | 13 | |
tanasaro10 | 8:f28ad4600b0f | 14 | |
tanasaro10 | 8:f28ad4600b0f | 15 | typedef struct { |
tanasaro10 | 8:f28ad4600b0f | 16 | uint8_t month; // 1..12 |
tanasaro10 | 8:f28ad4600b0f | 17 | uint8_t day; // 1..31 |
tanasaro10 | 8:f28ad4600b0f | 18 | uint8_t year; // 20_XX, 2016 => 16; |
tanasaro10 | 8:f28ad4600b0f | 19 | }date_t; |
tanasaro10 | 8:f28ad4600b0f | 20 | |
tanasaro10 | 8:f28ad4600b0f | 21 | |
tanasaro10 | 8:f28ad4600b0f | 22 | typedef struct{ |
tanasaro10 | 8:f28ad4600b0f | 23 | date_t currentDate; |
tanasaro10 | 8:f28ad4600b0f | 24 | date_t newDate; |
tanasaro10 | 8:f28ad4600b0f | 25 | bool updateDate; // true if currentDate needs to be updated with newDate; |
tanasaro10 | 8:f28ad4600b0f | 26 | } mdate_manager_t; |
tanasaro10 | 8:f28ad4600b0f | 27 | |
tanasaro10 | 8:f28ad4600b0f | 28 | |
tanasaro10 | 8:f28ad4600b0f | 29 | typedef struct { |
tanasaro10 | 8:f28ad4600b0f | 30 | float light; |
tanasaro10 | 8:f28ad4600b0f | 31 | float gndV; |
tanasaro10 | 8:f28ad4600b0f | 32 | float temp; |
tanasaro10 | 8:f28ad4600b0f | 33 | bool led_on; |
tanasaro10 | 8:f28ad4600b0f | 34 | mtime_t time; |
tanasaro10 | 8:f28ad4600b0f | 35 | date_t date; |
tanasaro10 | 8:f28ad4600b0f | 36 | } myData_t; |
tanasaro10 | 8:f28ad4600b0f | 37 | |
tanasaro10 | 8:f28ad4600b0f | 38 | #define MAXBUFFER 90 |
tanasaro10 | 8:f28ad4600b0f | 39 | // bool isInputValid(uint8_t * buffer); |
tanasaro10 | 8:f28ad4600b0f | 40 | |
tanasaro10 | 8:f28ad4600b0f | 41 | uint8_t eNrDaysPerMonth[12]= {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |