Sweep a servo according to Proximity sensor measure

Dependencies:   Servo X_NUCLEO_6180XA1 mbed

Fork of HelloWorld_6180XA1 by ST

Committer:
gallonm
Date:
Tue Oct 20 16:46:29 2015 +0200
Revision:
11:657dbe7bf245
Parent:
10:5319abadb31e
Child:
14:946e62f44f4f
Tested 2 and 3 sensors simultaneously with range continuous interrupt operating mode

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gallonm 0:83c628a58feb 1 #include "mbed.h"
gallonm 8:4c05f7a5bb60 2 #include "x_nucleo_6180xa1.h"
gallonm 0:83c628a58feb 3
gallonm 4:ccd62fd7e137 4 #include <string.h>
gallonm 4:ccd62fd7e137 5 #include <stdlib.h>
gallonm 4:ccd62fd7e137 6 #include <stdio.h>
gallonm 8:4c05f7a5bb60 7 #include <assert.h>
gallonm 8:4c05f7a5bb60 8
gallonm 5:fa65d931bd96 9 #define VL6180X_I2C_SDA I2C_SDA
gallonm 5:fa65d931bd96 10 #define VL6180X_I2C_SCL I2C_SCL
gallonm 5:fa65d931bd96 11
gallonm 10:5319abadb31e 12 //#define RANGE_SINGLE_SHOT_POLLING
gallonm 10:5319abadb31e 13 //#define ALS_SINGLE_SHOT_POLLING
gallonm 10:5319abadb31e 14 //#define RANGE_CONTINUOUS_POLLING
gallonm 10:5319abadb31e 15 //#define ALS_CONTINUOUS_POLLING
gallonm 10:5319abadb31e 16 //#define RANGE_CONTINUOUS_INTERRUPT
gallonm 11:657dbe7bf245 17 #define ALS_CONTINUOUS_INTERRUPT
gallonm 11:657dbe7bf245 18 //#define INTERLEAVED_MODE_INTERRUPT
gallonm 10:5319abadb31e 19 //#define RANGE_CONTINUOUS_POLLING_LOW_THRESHOLD
gallonm 10:5319abadb31e 20 //#define RANGE_CONTINUOUS_POLLING_HIGH_THRESHOLD
gallonm 10:5319abadb31e 21 //#define RANGE_CONTINUOUS_POLLING_OUT_OF_WINDOW
gallonm 10:5319abadb31e 22 //#define ALS_CONTINUOUS_POLLING_LOW_THRESHOLD
gallonm 10:5319abadb31e 23 //#define ALS_CONTINUOUS_POLLING_HIGH_THRESHOLD
gallonm 10:5319abadb31e 24 //#define ALS_CONTINUOUS_POLLING_OUT_OF_WINDOW
gallonm 10:5319abadb31e 25 //#define RANGE_CONTINUOUS_INTERRUPT_LOW_THRESHOLD
gallonm 10:5319abadb31e 26 //#define RANGE_CONTINUOUS_INTERRUPT_HIGH_THRESHOLD
gallonm 10:5319abadb31e 27 //#define RANGE_CONTINUOUS_INTERRUPT_OUT_OF_WINDOW
gallonm 10:5319abadb31e 28 //#define ALS_CONTINUOUS_INTERRUPT_LOW_THRESHOLD
gallonm 10:5319abadb31e 29 //#define ALS_CONTINUOUS_INTERRUPT_HIGH_THRESHOLD
gallonm 10:5319abadb31e 30 //#define ALS_CONTINUOUS_INTERRUPT_OUT_OF_WINDOW
gallonm 10:5319abadb31e 31
gallonm 9:1d0e839edee8 32 /* Polling operating modes (1,2,3 and 4) don`t require callback function that handles IRQ
gallonm 9:1d0e839edee8 33 Callback functions are used only for measure that require interrupt */
gallonm 5:fa65d931bd96 34
gallonm 11:657dbe7bf245 35 void OnErrLog(void){}; // sistemare la funzione per stampare il messaggio che gli viene passato
gallonm 5:fa65d931bd96 36 void DISP_ExecLoopBody(void){};
gallonm 0:83c628a58feb 37
gallonm 8:4c05f7a5bb60 38 DevI2C device_i2c(VL6180X_I2C_SDA, VL6180X_I2C_SCL);
gallonm 9:1d0e839edee8 39 static X_NUCLEO_6180XA1 *board=X_NUCLEO_6180XA1::Instance(&device_i2c);
gallonm 9:1d0e839edee8 40
gallonm 11:657dbe7bf245 41 MeasureData_t data_sensor_top, data_sensor_left, data_sensor_right;
gallonm 9:1d0e839edee8 42
gallonm 11:657dbe7bf245 43 Timer timer; // timer to debug
gallonm 11:657dbe7bf245 44 int start, end;
gallonm 11:657dbe7bf245 45
gallonm 9:1d0e839edee8 46 /* flags that handle the call to HandleIRQ function */
gallonm 9:1d0e839edee8 47 bool flag_sensor_top=false, flag_sensor_bottom=false, flag_sensor_left=false, flag_sensor_right=false;
gallonm 9:1d0e839edee8 48
gallonm 9:1d0e839edee8 49 /* callback functions of the sensors */
gallonm 9:1d0e839edee8 50 void SensorTopIRQ(void)
gallonm 9:1d0e839edee8 51 {
gallonm 11:657dbe7bf245 52 flag_sensor_top=true;
gallonm 9:1d0e839edee8 53 board->sensor_top->DisableInterruptMeasureDetectionIRQ();
gallonm 9:1d0e839edee8 54 }
gallonm 9:1d0e839edee8 55
gallonm 11:657dbe7bf245 56 void SensorBottomIRQ(void)
gallonm 11:657dbe7bf245 57 {
gallonm 11:657dbe7bf245 58 flag_sensor_bottom=true;
gallonm 11:657dbe7bf245 59 board->sensor_bottom->DisableInterruptMeasureDetectionIRQ();
gallonm 11:657dbe7bf245 60 }
gallonm 11:657dbe7bf245 61
gallonm 11:657dbe7bf245 62 void SensorLeftIRQ(void)
gallonm 11:657dbe7bf245 63 {
gallonm 11:657dbe7bf245 64 flag_sensor_left=true;
gallonm 11:657dbe7bf245 65 board->sensor_left->DisableInterruptMeasureDetectionIRQ();
gallonm 11:657dbe7bf245 66 }
gallonm 11:657dbe7bf245 67
gallonm 11:657dbe7bf245 68 void SensorRightIRQ(void)
gallonm 11:657dbe7bf245 69 {
gallonm 11:657dbe7bf245 70 flag_sensor_right=true;
gallonm 11:657dbe7bf245 71 board->sensor_right->DisableInterruptMeasureDetectionIRQ();
gallonm 11:657dbe7bf245 72 }
gallonm 9:1d0e839edee8 73
gallonm 4:ccd62fd7e137 74 int main()
gallonm 5:fa65d931bd96 75 {
gallonm 11:657dbe7bf245 76 int status, status_t, status_b, status_l, status_r;
gallonm 11:657dbe7bf245 77
gallonm 10:5319abadb31e 78 status=board->InitBoard();
gallonm 9:1d0e839edee8 79 if(status)
gallonm 9:1d0e839edee8 80 printf("Failed to init the board!\n\r");
gallonm 10:5319abadb31e 81
gallonm 10:5319abadb31e 82 #ifdef RANGE_SINGLE_SHOT_POLLING
gallonm 11:657dbe7bf245 83 status_t=board->sensor_top->StartMeasurement(range_single_shot_polling, NULL, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 84 if(!status_t)
gallonm 11:657dbe7bf245 85 printf("Top Range: %dmm\n\r",data_sensor_top.range_mm);
gallonm 10:5319abadb31e 86 else if(status==INVALID_PARAMS)
gallonm 9:1d0e839edee8 87 printf("Failed to start measurement!\n\r");
gallonm 9:1d0e839edee8 88 else
gallonm 10:5319abadb31e 89 printf("Invalid range value!\n\r");
gallonm 11:657dbe7bf245 90 status_t=board->sensor_top->StopMeasurement(range_single_shot_polling);
gallonm 11:657dbe7bf245 91 if(status_t)
gallonm 10:5319abadb31e 92 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 93 #endif
gallonm 9:1d0e839edee8 94
gallonm 10:5319abadb31e 95 #ifdef ALS_SINGLE_SHOT_POLLING
gallonm 11:657dbe7bf245 96 status_t=board->sensor_top->StartMeasurement(als_single_shot_polling, NULL, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 97 if(!status_t)
gallonm 11:657dbe7bf245 98 printf("Top Light: %dlux\n\r",data_sensor_top.lux);
gallonm 10:5319abadb31e 99 else if(status==INVALID_PARAMS)
gallonm 10:5319abadb31e 100 printf("Failed to start measurement!\n\r");
gallonm 10:5319abadb31e 101 else
gallonm 10:5319abadb31e 102 printf("Invalid light value!\n\r");
gallonm 11:657dbe7bf245 103 status_t=board->sensor_top->StopMeasurement(als_single_shot_polling);
gallonm 11:657dbe7bf245 104 if(status_t)
gallonm 10:5319abadb31e 105 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 106 #endif
gallonm 10:5319abadb31e 107
gallonm 10:5319abadb31e 108 #ifdef RANGE_CONTINUOUS_POLLING
gallonm 11:657dbe7bf245 109 status_t=board->sensor_top->StartMeasurement(range_continuous_polling, NULL, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 110 if(!status_t)
gallonm 9:1d0e839edee8 111 {
gallonm 10:5319abadb31e 112 int i;
gallonm 10:5319abadb31e 113 for(i=0;i<10;i++)
gallonm 10:5319abadb31e 114 {
gallonm 11:657dbe7bf245 115 status_t=board->sensor_top->GetMeasurement(range_continuous_polling, &data_sensor_top);
gallonm 11:657dbe7bf245 116 if(!status_t)
gallonm 11:657dbe7bf245 117 printf("Top Range measure %d: %dmm\n\r",i+1,data_sensor_top.range_mm);
gallonm 10:5319abadb31e 118 else
gallonm 10:5319abadb31e 119 printf("Invalid range value!\n\r");
gallonm 10:5319abadb31e 120 }
gallonm 10:5319abadb31e 121 }
gallonm 10:5319abadb31e 122 else
gallonm 10:5319abadb31e 123 printf("Failed to start measurement!\n\r");
gallonm 11:657dbe7bf245 124 status_t=board->sensor_top->StopMeasurement(range_continuous_polling);
gallonm 11:657dbe7bf245 125 if(status_t)
gallonm 10:5319abadb31e 126 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 127 #endif
gallonm 10:5319abadb31e 128
gallonm 10:5319abadb31e 129 #ifdef ALS_CONTINUOUS_POLLING
gallonm 11:657dbe7bf245 130 status_t=board->sensor_top->StartMeasurement(als_continuous_polling, NULL, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 131 if(!status_t)
gallonm 10:5319abadb31e 132 {
gallonm 10:5319abadb31e 133 int i;
gallonm 10:5319abadb31e 134 for(i=0;i<10;i++)
gallonm 10:5319abadb31e 135 {
gallonm 11:657dbe7bf245 136 status=board->sensor_top->GetMeasurement(als_continuous_polling, &data_sensor_top);
gallonm 11:657dbe7bf245 137 if(!status_t)
gallonm 11:657dbe7bf245 138 printf("Top Light measure %d: %dlux\n\r",i,data_sensor_top.lux);
gallonm 10:5319abadb31e 139 else
gallonm 10:5319abadb31e 140 printf("Invalid light value!\n\r");
gallonm 10:5319abadb31e 141 }
gallonm 9:1d0e839edee8 142 }
gallonm 9:1d0e839edee8 143 else
gallonm 9:1d0e839edee8 144 printf("Failed to start measurement!\n\r");
gallonm 11:657dbe7bf245 145 status_t=board->sensor_top->StopMeasurement(als_continuous_polling);
gallonm 11:657dbe7bf245 146 if(status_t)
gallonm 10:5319abadb31e 147 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 148 #endif
gallonm 9:1d0e839edee8 149
gallonm 11:657dbe7bf245 150 /*#ifdef RANGE_CONTINUOUS_INTERRUPT
gallonm 11:657dbe7bf245 151 status_t=board->sensor_top->StartMeasurement(range_continuous_interrupt, SensorTopIRQ, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 152 status_l=board->sensor_left->StartMeasurement(range_continuous_interrupt, SensorLeftIRQ, &data_sensor_left, NULL, NULL);
gallonm 11:657dbe7bf245 153 if((!status_t)&&(!status_l))
gallonm 9:1d0e839edee8 154 {
gallonm 11:657dbe7bf245 155 while(1)
gallonm 10:5319abadb31e 156 {
gallonm 10:5319abadb31e 157 if(flag_sensor_top)
gallonm 10:5319abadb31e 158 {
gallonm 10:5319abadb31e 159 flag_sensor_top=false;
gallonm 11:657dbe7bf245 160 status_t=board->sensor_top->HandleIRQ(range_continuous_interrupt, &data_sensor_top);
gallonm 11:657dbe7bf245 161 if(!status_t)
gallonm 11:657dbe7bf245 162 printf("Top Range: %dmm\n\r",data_sensor_top.range_mm);
gallonm 11:657dbe7bf245 163 else
gallonm 11:657dbe7bf245 164 printf("Invalid range value!\n\r");
gallonm 11:657dbe7bf245 165 }
gallonm 11:657dbe7bf245 166 if(flag_sensor_left)
gallonm 11:657dbe7bf245 167 {
gallonm 11:657dbe7bf245 168 flag_sensor_left=false;
gallonm 11:657dbe7bf245 169 status_l=board->sensor_left->HandleIRQ(range_continuous_interrupt, &data_sensor_left);
gallonm 11:657dbe7bf245 170 if(!status_l)
gallonm 11:657dbe7bf245 171 printf("Left Range: %dmm\n\r",data_sensor_left.range_mm);
gallonm 10:5319abadb31e 172 else
gallonm 10:5319abadb31e 173 printf("Invalid range value!\n\r");
gallonm 10:5319abadb31e 174 }
gallonm 10:5319abadb31e 175 }
gallonm 10:5319abadb31e 176 }
gallonm 10:5319abadb31e 177 else
gallonm 10:5319abadb31e 178 printf("Failed to start measurement!\n\r");
gallonm 11:657dbe7bf245 179 status_t=board->sensor_top->StopMeasurement(range_continuous_interrupt);
gallonm 11:657dbe7bf245 180 if(status_l)
gallonm 11:657dbe7bf245 181 printf("Failed to stop sensor_top measurement!\n\r");
gallonm 11:657dbe7bf245 182 status_l=board->sensor_left->StopMeasurement(range_continuous_interrupt);
gallonm 11:657dbe7bf245 183 if(status_l)
gallonm 11:657dbe7bf245 184 printf("Failed to stop sensor_left measurement!\n\r");
gallonm 11:657dbe7bf245 185 #endif*/
gallonm 11:657dbe7bf245 186
gallonm 11:657dbe7bf245 187 #ifdef RANGE_CONTINUOUS_INTERRUPT
gallonm 11:657dbe7bf245 188 status=board->sensor_top->StartMeasurement(range_continuous_interrupt, SensorTopIRQ, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 189 if(!status)
gallonm 11:657dbe7bf245 190 {
gallonm 11:657dbe7bf245 191 while(1)
gallonm 11:657dbe7bf245 192 {
gallonm 11:657dbe7bf245 193 if(flag_sensor_top)
gallonm 11:657dbe7bf245 194 {
gallonm 11:657dbe7bf245 195 flag_sensor_top=false;
gallonm 11:657dbe7bf245 196 status=board->sensor_top->HandleIRQ(range_continuous_interrupt, &data_sensor_top);
gallonm 11:657dbe7bf245 197 if(!status)
gallonm 11:657dbe7bf245 198 printf("Range: %dmm\n\r",data_sensor_top.range_mm);
gallonm 11:657dbe7bf245 199 else
gallonm 11:657dbe7bf245 200 printf("Invalid range value!\n\r");
gallonm 11:657dbe7bf245 201 }
gallonm 11:657dbe7bf245 202 }
gallonm 11:657dbe7bf245 203 }
gallonm 11:657dbe7bf245 204 else
gallonm 11:657dbe7bf245 205 printf("Failed to start measurement!\n\r");
gallonm 11:657dbe7bf245 206 status=board->sensor_top->StopMeasurement(range_continuous_interrupt);
gallonm 11:657dbe7bf245 207 if(status)
gallonm 11:657dbe7bf245 208 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 209 #endif
gallonm 10:5319abadb31e 210
gallonm 10:5319abadb31e 211 #ifdef ALS_CONTINUOUS_INTERRUPT
gallonm 11:657dbe7bf245 212 status_t=board->sensor_top->StartMeasurement(als_continuous_interrupt, SensorTopIRQ, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 213 if(!status_t)
gallonm 10:5319abadb31e 214 {
gallonm 10:5319abadb31e 215 while(1)
gallonm 10:5319abadb31e 216 {
gallonm 10:5319abadb31e 217 if(flag_sensor_top)
gallonm 10:5319abadb31e 218 {
gallonm 10:5319abadb31e 219 flag_sensor_top=false;
gallonm 11:657dbe7bf245 220 status_t=board->sensor_top->HandleIRQ(als_continuous_interrupt, &data_sensor_top);
gallonm 11:657dbe7bf245 221 if(!status_t)
gallonm 11:657dbe7bf245 222 printf("Top Light: %dlux\n\r",data_sensor_top.lux);
gallonm 10:5319abadb31e 223 else
gallonm 10:5319abadb31e 224 printf("Invalid light value!\n\r");
gallonm 10:5319abadb31e 225 }
gallonm 10:5319abadb31e 226 }
gallonm 10:5319abadb31e 227 }
gallonm 9:1d0e839edee8 228 else
gallonm 10:5319abadb31e 229 printf("Failed to stop measurement!\n\r");
gallonm 11:657dbe7bf245 230 status_t=board->sensor_top->StopMeasurement(als_continuous_interrupt);
gallonm 11:657dbe7bf245 231 if(status_t)
gallonm 10:5319abadb31e 232 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 233 #endif
gallonm 9:1d0e839edee8 234
gallonm 10:5319abadb31e 235 #ifdef INTERLEAVED_MODE_INTERRUPT
gallonm 11:657dbe7bf245 236 status_t=board->sensor_top->StartMeasurement(interleaved_mode_interrupt, SensorTopIRQ, &data_sensor_top, NULL, NULL);
gallonm 11:657dbe7bf245 237 if(!status_t)
gallonm 9:1d0e839edee8 238 {
gallonm 10:5319abadb31e 239 while(1)
gallonm 10:5319abadb31e 240 {
gallonm 10:5319abadb31e 241 if(flag_sensor_top)
gallonm 10:5319abadb31e 242 {
gallonm 10:5319abadb31e 243 flag_sensor_top=false;
gallonm 11:657dbe7bf245 244 status_t=board->sensor_top->HandleIRQ(interleaved_mode_interrupt, &data_sensor_top);
gallonm 11:657dbe7bf245 245 if(!status_t)
gallonm 10:5319abadb31e 246 {
gallonm 11:657dbe7bf245 247 printf("Top Range: %dmm ",data_sensor_top.range_mm);
gallonm 11:657dbe7bf245 248 printf("Top Light: %dlux\n\r",data_sensor_top.lux);
gallonm 10:5319abadb31e 249 }
gallonm 10:5319abadb31e 250 else
gallonm 10:5319abadb31e 251 printf("Invalid range or light value!\n\r");
gallonm 10:5319abadb31e 252 }
gallonm 10:5319abadb31e 253 }
gallonm 9:1d0e839edee8 254 }
gallonm 10:5319abadb31e 255 else
gallonm 10:5319abadb31e 256 printf("Failed to stop measurement!\n\r");
gallonm 11:657dbe7bf245 257 status_t=board->sensor_top->StopMeasurement(interleaved_mode_interrupt);
gallonm 11:657dbe7bf245 258 if(status_t)
gallonm 10:5319abadb31e 259 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 260 #endif
gallonm 10:5319abadb31e 261
gallonm 10:5319abadb31e 262 #ifdef RANGE_CONTINUOUS_INTERRUPT_LOW_THRESHOLD
gallonm 11:657dbe7bf245 263 status_t=board->sensor_top->StartMeasurement(range_continuous_interrupt_low_threshold, SensorTopIRQ, &data_sensor_top, 80, NULL);
gallonm 11:657dbe7bf245 264 if(!status_t)
gallonm 10:5319abadb31e 265 {
gallonm 10:5319abadb31e 266 while(1)
gallonm 10:5319abadb31e 267 {
gallonm 10:5319abadb31e 268 if(flag_sensor_top)
gallonm 10:5319abadb31e 269 {
gallonm 10:5319abadb31e 270 flag_sensor_top=false;
gallonm 11:657dbe7bf245 271 status_t=board->sensor_top->HandleIRQ(range_continuous_interrupt_low_threshold, &data_sensor_top);
gallonm 11:657dbe7bf245 272 if(!status_t)
gallonm 11:657dbe7bf245 273 printf("Range int low threshold: %dmm\n\r",data_sensor_top.range_mm);
gallonm 10:5319abadb31e 274 else
gallonm 10:5319abadb31e 275 printf("Invalid range value!\n\r");
gallonm 10:5319abadb31e 276 }
gallonm 10:5319abadb31e 277 }
gallonm 10:5319abadb31e 278 }
gallonm 10:5319abadb31e 279 else
gallonm 10:5319abadb31e 280 printf("Failed to start measurement!\n\r");
gallonm 11:657dbe7bf245 281 status_t=board->sensor_top->StopMeasurement(range_continuous_interrupt_low_threshold);
gallonm 11:657dbe7bf245 282 if(status_t)
gallonm 10:5319abadb31e 283 printf("Failed to stop measurement!\n\r");
gallonm 10:5319abadb31e 284 #endif
gallonm 5:fa65d931bd96 285
gallonm 11:657dbe7bf245 286 /*
gallonm 11:657dbe7bf245 287 status_l=board->sensor_left->StartMeasurement(range_continuous_interrupt, SensorLeftIRQ, &data_sensor_left, NULL, NULL);
gallonm 11:657dbe7bf245 288 status_r=board->sensor_right->StartMeasurement(als_continuous_interrupt, SensorRightIRQ, &data_sensor_right, NULL, NULL);
gallonm 11:657dbe7bf245 289 if((!status_l)&&(!status_r))
gallonm 11:657dbe7bf245 290 {
gallonm 11:657dbe7bf245 291 while(1)
gallonm 11:657dbe7bf245 292 {
gallonm 11:657dbe7bf245 293 if(flag_sensor_left)
gallonm 11:657dbe7bf245 294 {
gallonm 11:657dbe7bf245 295 flag_sensor_left=false;
gallonm 11:657dbe7bf245 296 status_l=board->sensor_left->HandleIRQ(range_continuous_interrupt, &data_sensor_left);
gallonm 11:657dbe7bf245 297 if(!status_l)
gallonm 11:657dbe7bf245 298 printf("Left Range: %dmm\n\r",data_sensor_left.range_mm);
gallonm 11:657dbe7bf245 299 else
gallonm 11:657dbe7bf245 300 printf("Invalid range value!\n\r");
gallonm 11:657dbe7bf245 301 }
gallonm 11:657dbe7bf245 302 if(flag_sensor_right)
gallonm 11:657dbe7bf245 303 {
gallonm 11:657dbe7bf245 304 flag_sensor_right=false;
gallonm 11:657dbe7bf245 305 status_r=board->sensor_right->HandleIRQ(als_continuous_interrupt, &data_sensor_right);
gallonm 11:657dbe7bf245 306 if(!status_r)
gallonm 11:657dbe7bf245 307 printf("Right Light: %dlux\n\r",data_sensor_right.lux);
gallonm 11:657dbe7bf245 308 else
gallonm 11:657dbe7bf245 309 printf("Invalid light value!\n\r");
gallonm 11:657dbe7bf245 310 }
gallonm 11:657dbe7bf245 311 }
gallonm 11:657dbe7bf245 312 }
gallonm 11:657dbe7bf245 313 else
gallonm 11:657dbe7bf245 314 printf("Failed to start measurement!\n\r");
gallonm 11:657dbe7bf245 315 status_t=board->sensor_top->StopMeasurement(range_continuous_interrupt_low_threshold);
gallonm 11:657dbe7bf245 316 if(status_t)
gallonm 11:657dbe7bf245 317 printf("Failed to stop measurement!\n\r");
gallonm 11:657dbe7bf245 318 status_t=board->sensor_top->StopMeasurement(als_continuous_interrupt);
gallonm 11:657dbe7bf245 319 if(status_t)
gallonm 11:657dbe7bf245 320 printf("Failed to stop measurement!\n\r");
gallonm 11:657dbe7bf245 321 */
gallonm 11:657dbe7bf245 322
gallonm 4:ccd62fd7e137 323 }
gallonm 5:fa65d931bd96 324
gallonm 5:fa65d931bd96 325