Here

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351 nRF24L01 FXOS8700

Committer:
tdh50
Date:
Mon Mar 13 15:54:10 2017 +0000
Revision:
5:09837d22b28f
Parent:
3:065e8a7824d4
Child:
7:46729d931f26
Accelerometer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-Hexiwear-Alert-System 0:6384ad26fe6c 1 #include "mbed.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 2 #include "Hexi_KW40Z.h"
tdh50 5:09837d22b28f 3 #include "FXOS8700.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 4 #include "Hexi_OLED_SSD1351.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 5 #include "OLED_types.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 6 #include "OpenSans_Font.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 7 #include "nRF24L01P.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 8 #include "string.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 9 #include "images.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 10
group-Hexiwear-Alert-System 0:6384ad26fe6c 11 #define NAME "RB"
group-Hexiwear-Alert-System 0:6384ad26fe6c 12
group-Hexiwear-Alert-System 0:6384ad26fe6c 13 #define LED_ON 0
group-Hexiwear-Alert-System 0:6384ad26fe6c 14 #define LED_OFF 1
tdh50 3:065e8a7824d4 15 #define NUM_OF_SCREENS 4
group-Hexiwear-Alert-System 0:6384ad26fe6c 16 #define TRANSFER_SIZE 4
tdh50 3:065e8a7824d4 17
group-Hexiwear-Alert-System 0:6384ad26fe6c 18 void StartHaptic(void);
group-Hexiwear-Alert-System 0:6384ad26fe6c 19 void StopHaptic(void const *n);
group-Hexiwear-Alert-System 0:6384ad26fe6c 20 void txTask(void);
tdh50 5:09837d22b28f 21 void accelero(void);
tdh50 3:065e8a7824d4 22 void displayHome();
tdh50 3:065e8a7824d4 23 void screenHandler(uint8_t screen);
group-Hexiwear-Alert-System 0:6384ad26fe6c 24
group-Hexiwear-Alert-System 0:6384ad26fe6c 25 DigitalOut redLed(LED1,1);
group-Hexiwear-Alert-System 0:6384ad26fe6c 26 DigitalOut greenLed(LED2,1);
group-Hexiwear-Alert-System 0:6384ad26fe6c 27 DigitalOut blueLed(LED3,1);
group-Hexiwear-Alert-System 0:6384ad26fe6c 28 DigitalOut haptic(PTB9);
group-Hexiwear-Alert-System 0:6384ad26fe6c 29
group-Hexiwear-Alert-System 0:6384ad26fe6c 30 /* Define timer for haptic feedback */
group-Hexiwear-Alert-System 0:6384ad26fe6c 31 RtosTimer hapticTimer(StopHaptic, osTimerOnce);
tdh50 5:09837d22b28f 32 /* */
tdh50 5:09837d22b28f 33 FXOS8700 accel(PTC11, PTC10);
tdh50 3:065e8a7824d4 34 /* Instantiate the Hexi KW40Z Driver (UART TX, UART RX) */
group-Hexiwear-Alert-System 0:6384ad26fe6c 35 KW40Z kw40z_device(PTE24, PTE25);
tdh50 5:09837d22b28f 36 Serial pc(USBTX, USBRX); // Serial interface
tdh50 3:065e8a7824d4 37 /* Instantiate the SSD1351 OLED Driver */
group-Hexiwear-Alert-System 0:6384ad26fe6c 38 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); /* (MOSI,SCLK,POWER,CS,RST,DC) */
group-Hexiwear-Alert-System 0:6384ad26fe6c 39 oled_text_properties_t textProperties = {0};
tdh50 3:065e8a7824d4 40 /* Instantiate the nRF24L01P Driver */
group-Hexiwear-Alert-System 0:6384ad26fe6c 41 nRF24L01P my_nrf24l01p(PTC6,PTC7,PTC5,PTC4,PTB2,NC); // mosi, miso, sck, csn, ce, irq
group-Hexiwear-Alert-System 0:6384ad26fe6c 42
tdh50 3:065e8a7824d4 43 /* Text Buffer */
tdh50 5:09837d22b28f 44 char text1[20]; // Text Buffer for dynamic value displayed
tdh50 5:09837d22b28f 45 char text2[20]; // Text Buffer for dynamic value displayed
tdh50 5:09837d22b28f 46 char text3[20]; // Text Buffer for dynamic value displayed
group-Hexiwear-Alert-System 0:6384ad26fe6c 47
tdh50 5:09837d22b28f 48 float accel_data[3]; // Storage for the data from the sensor
tdh50 5:09837d22b28f 49 float accel_rms=0.0; // RMS value from the sensor
tdh50 5:09837d22b28f 50 float ax, ay, az; // Integer value from the sensor to be displayed
group-Hexiwear-Alert-System 0:6384ad26fe6c 51 uint8_t screenNum=0;
tdh50 3:065e8a7824d4 52 bool prefix=0;
tdh50 5:09837d22b28f 53 bool accelerometer = false;
group-Hexiwear-Alert-System 0:6384ad26fe6c 54 bool sentMessageDisplayedFlag=0;
group-Hexiwear-Alert-System 0:6384ad26fe6c 55 char rxData[TRANSFER_SIZE];
group-Hexiwear-Alert-System 0:6384ad26fe6c 56 char txData[TRANSFER_SIZE];
group-Hexiwear-Alert-System 0:6384ad26fe6c 57
tdh50 3:065e8a7824d4 58 /* Pointer for the image to be displayed */
DeanBritt 2:172492c41c48 59 const uint8_t *SafeBMP = HexiSafe96_bmp;
tdh50 3:065e8a7824d4 60 const uint8_t *HeartBMP = HeartRate_bmp;
tdh50 3:065e8a7824d4 61 const uint8_t *FallBMP = FallDet_bmp;
tdh50 3:065e8a7824d4 62 const uint8_t *FallPageBMP = FallDetPage_bmp;
tdh50 3:065e8a7824d4 63 const uint8_t *HomeBMP = Home_bmp;
tdh50 3:065e8a7824d4 64 const uint8_t *HeartPageBMP = HeartRatePage_bmp;
DeanBritt 2:172492c41c48 65
tdh50 3:065e8a7824d4 66
group-Hexiwear-Alert-System 0:6384ad26fe6c 67 /****************************Call Back Functions*******************************/
tdh50 3:065e8a7824d4 68 /*Enter Button */
group-Hexiwear-Alert-System 0:6384ad26fe6c 69 void ButtonRight(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 70 {
tdh50 3:065e8a7824d4 71 // All screens other than 1 have either and enter button
tdh50 3:065e8a7824d4 72 // or a home buttom.
tdh50 3:065e8a7824d4 73 if(screenNum != 1) {
group-Hexiwear-Alert-System 0:6384ad26fe6c 74 StartHaptic();
tdh50 3:065e8a7824d4 75 switch(screenNum) {
tdh50 3:065e8a7824d4 76 case 0: {
tdh50 3:065e8a7824d4 77 screenNum++;
tdh50 3:065e8a7824d4 78 screenHandler(screenNum);
tdh50 3:065e8a7824d4 79 break;
tdh50 3:065e8a7824d4 80 }
tdh50 3:065e8a7824d4 81 case 2: {
tdh50 3:065e8a7824d4 82 screenNum = screenNum + 2;
tdh50 3:065e8a7824d4 83 screenHandler(screenNum);
tdh50 3:065e8a7824d4 84 break;
tdh50 3:065e8a7824d4 85 }
tdh50 3:065e8a7824d4 86 case 3: {
tdh50 3:065e8a7824d4 87 screenNum = screenNum + 2;
tdh50 3:065e8a7824d4 88 screenHandler(screenNum);
tdh50 3:065e8a7824d4 89 break;
tdh50 3:065e8a7824d4 90 }
tdh50 3:065e8a7824d4 91 case 4:
tdh50 3:065e8a7824d4 92 case 5: {
tdh50 5:09837d22b28f 93 accelerometer = false;
tdh50 3:065e8a7824d4 94 screenNum = 0;
tdh50 3:065e8a7824d4 95 break;
tdh50 3:065e8a7824d4 96 }
tdh50 3:065e8a7824d4 97 default: {
tdh50 3:065e8a7824d4 98 break;
tdh50 3:065e8a7824d4 99 }
tdh50 3:065e8a7824d4 100 }
tdh50 5:09837d22b28f 101 screenHandler(screenNum);
group-Hexiwear-Alert-System 0:6384ad26fe6c 102 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 103 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 104
tdh50 3:065e8a7824d4 105 /*Back Button */
group-Hexiwear-Alert-System 0:6384ad26fe6c 106 void ButtonLeft(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 107 {
tdh50 3:065e8a7824d4 108 if(screenNum > 0) {
tdh50 3:065e8a7824d4 109 StartHaptic();
tdh50 3:065e8a7824d4 110 //Allow user to go back to correct screen based on srceen number
tdh50 3:065e8a7824d4 111 //Refer to screenHandler for screen numbers
tdh50 3:065e8a7824d4 112 if(screenNum == 3 || screenNum == 4 || screenNum == 5) {
tdh50 3:065e8a7824d4 113 screenNum = screenNum - 2;
tdh50 5:09837d22b28f 114 accelerometer = false;
tdh50 5:09837d22b28f 115 }
tdh50 5:09837d22b28f 116 else {
tdh50 3:065e8a7824d4 117 screenNum--;
tdh50 3:065e8a7824d4 118 }
tdh50 3:065e8a7824d4 119 screenHandler(screenNum);
tdh50 3:065e8a7824d4 120 }
tdh50 3:065e8a7824d4 121
group-Hexiwear-Alert-System 0:6384ad26fe6c 122 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 123
tdh50 3:065e8a7824d4 124 /*Advances to Heartrate only when user
tdh50 3:065e8a7824d4 125 is on Hexisafe screen */
group-Hexiwear-Alert-System 0:6384ad26fe6c 126 void ButtonUp(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 127 {
tdh50 3:065e8a7824d4 128 if (screenNum == 1) {
group-Hexiwear-Alert-System 0:6384ad26fe6c 129 StartHaptic();
tdh50 3:065e8a7824d4 130 screenNum++;
tdh50 3:065e8a7824d4 131 screenHandler(screenNum);
tdh50 3:065e8a7824d4 132 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 133
tdh50 3:065e8a7824d4 134
group-Hexiwear-Alert-System 0:6384ad26fe6c 135 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 136
tdh50 3:065e8a7824d4 137 /*Advances to Fall Detection only when user
tdh50 3:065e8a7824d4 138 is on Hexisafe screen */
group-Hexiwear-Alert-System 0:6384ad26fe6c 139 void ButtonDown(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 140 {
tdh50 3:065e8a7824d4 141 if (screenNum == 1) {
tdh50 3:065e8a7824d4 142 StartHaptic();
tdh50 3:065e8a7824d4 143 screenNum= screenNum + 2;
tdh50 3:065e8a7824d4 144 screenHandler(screenNum);
group-Hexiwear-Alert-System 0:6384ad26fe6c 145 }
tdh50 3:065e8a7824d4 146
group-Hexiwear-Alert-System 0:6384ad26fe6c 147 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 148
group-Hexiwear-Alert-System 0:6384ad26fe6c 149
group-Hexiwear-Alert-System 0:6384ad26fe6c 150 /***********************End of Call Back Functions*****************************/
group-Hexiwear-Alert-System 0:6384ad26fe6c 151
group-Hexiwear-Alert-System 0:6384ad26fe6c 152 /********************************Main******************************************/
group-Hexiwear-Alert-System 0:6384ad26fe6c 153
group-Hexiwear-Alert-System 0:6384ad26fe6c 154 int main()
tdh50 3:065e8a7824d4 155 {
tdh50 3:065e8a7824d4 156 /* Wait Sequence in the beginning for board to be reset then placed in mini docking station*/
group-Hexiwear-Alert-System 0:6384ad26fe6c 157 blueLed=1;
tdh50 3:065e8a7824d4 158
group-Hexiwear-Alert-System 0:6384ad26fe6c 159
tdh50 3:065e8a7824d4 160
group-Hexiwear-Alert-System 0:6384ad26fe6c 161 /* Get OLED Class Default Text Properties */
tdh50 3:065e8a7824d4 162 oled.GetTextProperties(&textProperties);
group-Hexiwear-Alert-System 0:6384ad26fe6c 163
group-Hexiwear-Alert-System 0:6384ad26fe6c 164 /* Register callbacks to application functions */
group-Hexiwear-Alert-System 0:6384ad26fe6c 165 kw40z_device.attach_buttonLeft(&ButtonLeft);
group-Hexiwear-Alert-System 0:6384ad26fe6c 166 kw40z_device.attach_buttonRight(&ButtonRight);
group-Hexiwear-Alert-System 0:6384ad26fe6c 167 kw40z_device.attach_buttonUp(&ButtonUp);
group-Hexiwear-Alert-System 0:6384ad26fe6c 168 kw40z_device.attach_buttonDown(&ButtonDown);
tdh50 3:065e8a7824d4 169
tdh50 3:065e8a7824d4 170 /* Change font color to white */
group-Hexiwear-Alert-System 0:6384ad26fe6c 171 textProperties.fontColor = COLOR_WHITE;
group-Hexiwear-Alert-System 0:6384ad26fe6c 172 textProperties.alignParam = OLED_TEXT_ALIGN_CENTER;
group-Hexiwear-Alert-System 0:6384ad26fe6c 173 oled.SetTextProperties(&textProperties);
group-Hexiwear-Alert-System 0:6384ad26fe6c 174
tdh50 3:065e8a7824d4 175 /*Displays the Home Screen*/
tdh50 3:065e8a7824d4 176 displayHome();
tdh50 3:065e8a7824d4 177
tdh50 3:065e8a7824d4 178 while (true) {
tdh50 5:09837d22b28f 179 if(accelerometer ==true)
tdh50 5:09837d22b28f 180 {
tdh50 5:09837d22b28f 181 accelero();
group-Hexiwear-Alert-System 0:6384ad26fe6c 182 }
tdh50 5:09837d22b28f 183 redLed = 1 ;
group-Hexiwear-Alert-System 0:6384ad26fe6c 184 Thread::wait(50);
group-Hexiwear-Alert-System 0:6384ad26fe6c 185 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 186 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 187
group-Hexiwear-Alert-System 0:6384ad26fe6c 188 /******************************End of Main*************************************/
tdh50 3:065e8a7824d4 189 //Intiates Vibration
tdh50 3:065e8a7824d4 190 void StartHaptic(void)
tdh50 3:065e8a7824d4 191 {
group-Hexiwear-Alert-System 0:6384ad26fe6c 192 hapticTimer.start(50);
group-Hexiwear-Alert-System 0:6384ad26fe6c 193 haptic = 1;
group-Hexiwear-Alert-System 0:6384ad26fe6c 194 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 195
tdh50 3:065e8a7824d4 196 void StopHaptic(void const *n)
tdh50 3:065e8a7824d4 197 {
group-Hexiwear-Alert-System 0:6384ad26fe6c 198 haptic = 0;
group-Hexiwear-Alert-System 0:6384ad26fe6c 199 hapticTimer.stop();
group-Hexiwear-Alert-System 0:6384ad26fe6c 200 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 201
tdh50 3:065e8a7824d4 202 void displayHome(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 203 {
tdh50 3:065e8a7824d4 204 oled.DrawImage(HomeBMP,0,0);
tdh50 3:065e8a7824d4 205 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 206
group-Hexiwear-Alert-System 0:6384ad26fe6c 207
tdh50 3:065e8a7824d4 208 void screenHandler(uint8_t screen)
group-Hexiwear-Alert-System 0:6384ad26fe6c 209 {
tdh50 3:065e8a7824d4 210 //Switching screens
tdh50 3:065e8a7824d4 211 switch(screen) {
tdh50 3:065e8a7824d4 212 case 0: {
tdh50 3:065e8a7824d4 213 displayHome();
tdh50 3:065e8a7824d4 214 break;
tdh50 3:065e8a7824d4 215 }
tdh50 3:065e8a7824d4 216 case 1: {
tdh50 3:065e8a7824d4 217 //Switching to SafeBMP
tdh50 3:065e8a7824d4 218 oled.DrawImage(SafeBMP,0,0);
tdh50 3:065e8a7824d4 219 break;
tdh50 3:065e8a7824d4 220 }
tdh50 3:065e8a7824d4 221 case 2: {
tdh50 3:065e8a7824d4 222 //Switching to HeartBMP
tdh50 3:065e8a7824d4 223 oled.DrawImage(HeartBMP,0,0);
group-Hexiwear-Alert-System 0:6384ad26fe6c 224 break;
tdh50 3:065e8a7824d4 225 }
tdh50 3:065e8a7824d4 226 case 3: {
tdh50 3:065e8a7824d4 227 //Switching to FallBMP
tdh50 3:065e8a7824d4 228 oled.DrawImage(FallBMP,0,0);
group-Hexiwear-Alert-System 0:6384ad26fe6c 229 break;
tdh50 3:065e8a7824d4 230 }
tdh50 3:065e8a7824d4 231 case 4: {
tdh50 3:065e8a7824d4 232 //Switching to HeartPageBMP
tdh50 3:065e8a7824d4 233 oled.DrawImage(HeartPageBMP,0,0);
tdh50 3:065e8a7824d4 234 break;
tdh50 3:065e8a7824d4 235 }
tdh50 3:065e8a7824d4 236 case 5: {
tdh50 3:065e8a7824d4 237 //Switching to FallPageBMP
tdh50 5:09837d22b28f 238 accelerometer = true;
tdh50 3:065e8a7824d4 239 break;
tdh50 3:065e8a7824d4 240 }
tdh50 3:065e8a7824d4 241 default: {
group-Hexiwear-Alert-System 0:6384ad26fe6c 242 break;
group-Hexiwear-Alert-System 0:6384ad26fe6c 243 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 244 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 245
group-Hexiwear-Alert-System 0:6384ad26fe6c 246
tdh50 3:065e8a7824d4 247 //Append Initials to txData[2:3].
tdh50 3:065e8a7824d4 248 //strcat(txData,NAME);
tdh50 3:065e8a7824d4 249
group-Hexiwear-Alert-System 0:6384ad26fe6c 250 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 251
tdh50 5:09837d22b28f 252 void accelero(void){
tdh50 5:09837d22b28f 253 // Configure Accelerometer FXOS8700, Magnetometer FXOS8700
tdh50 5:09837d22b28f 254 accel.accel_config();
tdh50 5:09837d22b28f 255 oled.DrawImage(FallPageBMP,0,0);
tdh50 5:09837d22b28f 256 // Fill 96px by 96px Screen with 96px by 96px Image starting at x=0,y=0
tdh50 5:09837d22b28f 257 while (screenNum == 5)
tdh50 5:09837d22b28f 258 {
tdh50 5:09837d22b28f 259
tdh50 5:09837d22b28f 260 accel.acquire_accel_data_g(accel_data);
tdh50 5:09837d22b28f 261 accel_rms = sqrt(((accel_data[0]*accel_data[0])+(accel_data[1]*accel_data[1])+(accel_data[2]*accel_data[2]))/3);
tdh50 5:09837d22b28f 262 printf("Accelerometer \tX-Axis %4.2f \tY-Axis %4.2f \tZ-Axis %4.2f \tRMS %4.2f\n\r",accel_data[0],accel_data[1],accel_data[2],accel_rms);
tdh50 5:09837d22b28f 263 wait(0.01);
tdh50 5:09837d22b28f 264 ax = accel_data[0];
tdh50 5:09837d22b28f 265 ay = accel_data[1];
tdh50 5:09837d22b28f 266 az = accel_data[2];
tdh50 5:09837d22b28f 267 /* Get OLED Class Default Text Properties */
tdh50 5:09837d22b28f 268 oled_text_properties_t textProperties = {0};
tdh50 5:09837d22b28f 269 oled.GetTextProperties(&textProperties);
tdh50 5:09837d22b28f 270
tdh50 5:09837d22b28f 271 /* Set text properties to white and right aligned for the dynamic text */
tdh50 5:09837d22b28f 272 textProperties.fontColor = COLOR_BLUE;
tdh50 5:09837d22b28f 273 textProperties.alignParam = OLED_TEXT_ALIGN_LEFT;
tdh50 5:09837d22b28f 274 oled.SetTextProperties(&textProperties);
tdh50 5:09837d22b28f 275
tdh50 5:09837d22b28f 276 /* Display Legends */
tdh50 5:09837d22b28f 277 strcpy((char *) text1,"X-Axis (g):");
tdh50 5:09837d22b28f 278 oled.Label((uint8_t *)text1,5,26);
tdh50 5:09837d22b28f 279
tdh50 5:09837d22b28f 280 /* Format the value */
tdh50 5:09837d22b28f 281 sprintf(text1,"%4.2f",ax);
tdh50 5:09837d22b28f 282 /* Display time reading in 35px by 15px textbox at(x=55, y=40) */
tdh50 5:09837d22b28f 283 oled.TextBox((uint8_t *)text1,70,26,20,15); //Increase textbox for more digits
tdh50 5:09837d22b28f 284
tdh50 5:09837d22b28f 285 /* Set text properties to white and right aligned for the dynamic text */
tdh50 5:09837d22b28f 286 textProperties.fontColor = COLOR_GREEN;
tdh50 5:09837d22b28f 287 textProperties.alignParam = OLED_TEXT_ALIGN_LEFT;
tdh50 5:09837d22b28f 288 oled.SetTextProperties(&textProperties);
tdh50 5:09837d22b28f 289
tdh50 5:09837d22b28f 290 /* Display Legends */
tdh50 5:09837d22b28f 291 strcpy((char *) text2,"Y-Axis (g):");
tdh50 5:09837d22b28f 292 oled.Label((uint8_t *)text2,5,43);
tdh50 5:09837d22b28f 293
tdh50 5:09837d22b28f 294 /* Format the value */
tdh50 5:09837d22b28f 295 sprintf(text2,"%4.2f",ay);
tdh50 5:09837d22b28f 296 /* Display time reading in 35px by 15px textbox at(x=55, y=40) */
tdh50 5:09837d22b28f 297 oled.TextBox((uint8_t *)text2,70,43,20,15); //Increase textbox for more digits
tdh50 5:09837d22b28f 298
tdh50 5:09837d22b28f 299 /* Set text properties to white and right aligned for the dynamic text */
tdh50 5:09837d22b28f 300 textProperties.fontColor = COLOR_RED;
tdh50 5:09837d22b28f 301 textProperties.alignParam = OLED_TEXT_ALIGN_LEFT;
tdh50 5:09837d22b28f 302 oled.SetTextProperties(&textProperties);
tdh50 5:09837d22b28f 303
tdh50 5:09837d22b28f 304 /* Display Legends */
tdh50 5:09837d22b28f 305 strcpy((char *) text3,"Z-Axis (g):");
tdh50 5:09837d22b28f 306 oled.Label((uint8_t *)text3,5,60);
tdh50 5:09837d22b28f 307
tdh50 5:09837d22b28f 308 /* Format the value */
tdh50 5:09837d22b28f 309 sprintf(text3,"%4.2f",az);
tdh50 5:09837d22b28f 310 /* Display time reading in 35px by 15px textbox at(x=55, y=40) */
tdh50 5:09837d22b28f 311 oled.TextBox((uint8_t *)text3,70,60,20,15); //Increase textbox for more digits
tdh50 5:09837d22b28f 312
tdh50 5:09837d22b28f 313 redLed = !redLed ;
tdh50 5:09837d22b28f 314 Thread::wait(1000);
tdh50 5:09837d22b28f 315 }
tdh50 5:09837d22b28f 316 }
tdh50 5:09837d22b28f 317