SunTracker_BLE

Dependencies:   BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 X_NUCLEO_IHM01A1 X_NUCLEO_IKS01A1 mbed

Fork of SunTracker_BLE by ST Expansion SW Team

Overview

The SunTracker is a demo application running on ST Nucleo-F401RE stacking a set of ST X-NUCLEO expansion boards.
Main features provided are:

  • A solar panel follows the light source, orienting the panel in order to achieve the best panel efficiency.
  • Orientation is controlled thanks to a couple of VL6180X FlightSense light sensors mounted on a X-NUCLEO-6180XA1 expansion board and driven by X-NUCLEO-IHM01A1 controlled stepper motor acting as actuator to orientate the panel.
  • The system features a progressive control on the stepper motor in order to modulate the panel rotation speed according to the light angle.
  • The application is also able to control the panel productivity reading the panel voltage through an ADC and proving feedback on the local display.
  • A manual orientation is possible by using the accelerometer on a X-NUCLEO-IKS01A1 expansion board that, according on board tilt, controls the speed and the rotate direction.
  • A remote control is available using a X-NUCLEO-IDB04A1 or a X-NUCLEO-IDB05A1 Bluetooth Low Energy expansion board. Remote control software is here.

/media/uploads/fabiombed/suntracker_server-client.png

Working Status

  • SunTracker has 3 working status visible on FlightSense display and switchable by pressing the User Button:

Status 0 (Idle)

  • Motor: Free Turning
  • Display: Waiting for User Button

Status 1

  • Motor: Driven by Light
  • Display: Direction and Light Intensity = Direction and Motor Speed

Status 2

  • Motor: Driven by Light
  • Display: Solar Panel Efficiency

Status 3

  • Motor: Driven by Accelerometer
  • Display: Direction and Accelerometer Intensity

Server Startup

  • When you plug the power supply, the word ‘PUSH’ is shown on display.
  • You can manually rotate the structure to assign the ‘Zero Point’. Then press the User Button to launch the application.
  • The display will show this status, which means that the structure is oriented to maximize the efficiency of the solar panel.
  • If there is a light displacement, the structure will rotate, left or right, to follow the light source and on display is shown the direction and the speed.
  • You can press the User Button to show the panel efficiency with 4 digits that represent the range from 0v (0000) to 3,3v (3300).
  • Further pressing the User Button you will manual rotate the panel by tilt the Server or Client accelerometer depending by BLE connection.

Client Startup

  • The Client application can remotely control the User Button and the Accelerometer functions.
  • Power on the Client AFTER the Server, it will automatically search for the SunTracker and will establish a BLE connection.
  • The Green Led on Nucleo Client board will be powered on.

Rotation Features

  • It has been implemented a block of rotation to avoid cables twist.
  • The blocking point can be set in the firmware by changing a constant.
  • You can manually rotate the structure to assign the ‘Zero Point’ before press the User Button to launch the application.
  • The system features a progressive control on the stepper motor in order to modulate the rotation speed according to the light or accelerometer angle.

List of Components

SERVER SunTracker_BLE

  • Stepper Motor 400’’ (Part Number 5350401) - To orientate the Mechanical Structure.
  • Solar Panel 0.446w (Part Number 0194127) - To capture sunlight and generate electrical current.
  • Power Supply 12v (Part Number 7262993) - To provide power supply at the Stepper Motor.
  • Flat Cable 6 ways (Part Number 1807010) - To plug VL6180X-SATEL with X-NUCLEO-6180XA1 (60cm length each x2).
  • Cable Connector (Part Number 6737694) - To plug the Flat Cable (x4).
  • Power Connector (Part Number 0487842) - To provide Power Supply to X-NUCLEO-IHM01A1.

CLIENT SunTracker_BLE_Remote

MECHANICAL STRUCTURE

Find here the STL files to print with a 3D printer.

/media/uploads/fabiombed/assembly.png

/media/uploads/fabiombed/mechanical_structure_and_motor_legs.png

FLAT CABLE ASSEMBLY

/media/uploads/fabiombed/flat_cable.png

HARDWARE SETUP

Nucleo ADC + Solar Panel

Connect Solar Panel cables to Nucleo Morpho PC_3 (white) and Nucleo Morpho GND (black). Connect a capacitor 10uF between PC_3 and GND to stabilize its voltage value shown on display.

EasySpin (L6474) + BLE

Hardware conflict between EasySpin DIR1 and BLE Reset, both on same Arduino Pin PA_8. Disconnect PA_8 between EasySpin and Nucleo by fold EasySpin Pin. PB_2 has been configured as EasySpin DIR1 in the firmware . Connect Nucleo Morpho PB_2 to FlightSense Arduino PA_8 by a wire.

FlightSense Satellites

In case of instability with I2C due to long flat cables, solder 4 SMD capacitors 47pF on FlightSense board in parallel between R15, R16, R17, R18 and plug 2 capacitors 15pF between FlightSense Arduino PB_8 and PB_9 to GND pin to cut-off noises over 720 KHz.

Arduino & Morpho Pinout

/media/uploads/fabiombed/arduino_pinout.png /media/uploads/fabiombed/morpho_pinout.png

Committer:
fabiombed
Date:
Wed Mar 16 19:17:08 2016 +0000
Revision:
14:644f9e7278e9
Parent:
12:1e6a1d3a66b5
Child:
15:019b8d60c89d
Update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fabiombed 0:becf0d313663 1 /**
fabiombed 0:becf0d313663 2 ******************************************************************************
fabiombed 0:becf0d313663 3 * @file main.cpp
fabiombed 1:8f312c1686b6 4 * @author Fabio Brembilla
fabiombed 4:1d3d071a4c2c 5 * @version V2.0.0
fabiombed 12:1e6a1d3a66b5 6 * @date March, 2016
fabiombed 12:1e6a1d3a66b5 7 * @brief SunTracker + BLE (Server) Vertical Application
fabiombed 1:8f312c1686b6 8 * This application use IHM01A1, 6180XA1, IKS01A1, IDB0XA1 expansion boards
fabiombed 0:becf0d313663 9 ******************************************************************************
fabiombed 0:becf0d313663 10 * @attention
fabiombed 4:1d3d071a4c2c 11 *
fabiombed 4:1d3d071a4c2c 12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
fabiombed 0:becf0d313663 13 *
fabiombed 0:becf0d313663 14 * Redistribution and use in source and binary forms, with or without modification,
fabiombed 0:becf0d313663 15 * are permitted provided that the following conditions are met:
fabiombed 0:becf0d313663 16 * 1. Redistributions of source code must retain the above copyright notice,
fabiombed 0:becf0d313663 17 * this list of conditions and the following disclaimer.
fabiombed 0:becf0d313663 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
fabiombed 0:becf0d313663 19 * this list of conditions and the following disclaimer in the documentation
fabiombed 0:becf0d313663 20 * and/or other materials provided with the distribution.
fabiombed 0:becf0d313663 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
fabiombed 0:becf0d313663 22 * may be used to endorse or promote products derived from this software
fabiombed 0:becf0d313663 23 * without specific prior written permission.
fabiombed 0:becf0d313663 24 *
fabiombed 0:becf0d313663 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
fabiombed 0:becf0d313663 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
fabiombed 0:becf0d313663 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
fabiombed 0:becf0d313663 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
fabiombed 0:becf0d313663 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
fabiombed 0:becf0d313663 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
fabiombed 0:becf0d313663 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
fabiombed 0:becf0d313663 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
fabiombed 0:becf0d313663 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
fabiombed 0:becf0d313663 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
fabiombed 0:becf0d313663 35 *
fabiombed 0:becf0d313663 36 ******************************************************************************
fabiombed 0:becf0d313663 37 */
fabiombed 4:1d3d071a4c2c 38
fabiombed 14:644f9e7278e9 39 /* Define --------------------------------------------------------------------*/
fabiombed 14:644f9e7278e9 40
fabiombed 14:644f9e7278e9 41 #define FlightSense //6180XA1 Main (remove only for debug)
fabiombed 14:644f9e7278e9 42 #define EasySpin //IHM01A1 Main (remove only for debug)
fabiombed 14:644f9e7278e9 43 #define Sensors //IKS01A1 Option
fabiombed 14:644f9e7278e9 44 #define Ble //IDB0XA1 Option
fabiombed 14:644f9e7278e9 45
fabiombed 0:becf0d313663 46 /* Includes ------------------------------------------------------------------*/
fabiombed 4:1d3d071a4c2c 47
fabiombed 6:4cbf7303b496 48 // Mbed specific header files
fabiombed 0:becf0d313663 49 #include "mbed.h"
fabiombed 4:1d3d071a4c2c 50
fabiombed 6:4cbf7303b496 51 // Helper header files
fabiombed 0:becf0d313663 52 #include "DevSPI.h"
fabiombed 1:8f312c1686b6 53 #include "DevI2C.h"
fabiombed 0:becf0d313663 54
fabiombed 6:4cbf7303b496 55 // Component specific header files
fabiombed 14:644f9e7278e9 56 #ifdef FlightSense
fabiombed 14:644f9e7278e9 57 #include "x_nucleo_6180xa1.h"
fabiombed 14:644f9e7278e9 58 #endif
fabiombed 14:644f9e7278e9 59
fabiombed 14:644f9e7278e9 60 #ifdef EasySpin
fabiombed 14:644f9e7278e9 61 #include "l6474_class.h"
fabiombed 14:644f9e7278e9 62 #endif
fabiombed 14:644f9e7278e9 63
fabiombed 14:644f9e7278e9 64 #ifdef Sensors
fabiombed 14:644f9e7278e9 65 #include "x_nucleo_iks01a1.h"
fabiombed 14:644f9e7278e9 66 #endif
fabiombed 0:becf0d313663 67
fabiombed 6:4cbf7303b496 68 // C header files
fabiombed 1:8f312c1686b6 69 #include <string.h>
fabiombed 1:8f312c1686b6 70 #include <stdlib.h>
fabiombed 1:8f312c1686b6 71 #include <stdio.h>
fabiombed 1:8f312c1686b6 72 #include <assert.h>
fabiombed 0:becf0d313663 73
fabiombed 5:76fb6b783487 74 /* BlueTooth -----------------------------------------------------------------*/
fabiombed 5:76fb6b783487 75
fabiombed 14:644f9e7278e9 76 #ifdef Ble
fabiombed 14:644f9e7278e9 77
fabiombed 5:76fb6b783487 78 #include "debug.h" // Need for PRINTF
fabiombed 14:644f9e7278e9 79 #include "Utils.h" // Need for STORE_LE_16 and STORE_LE_32
fabiombed 5:76fb6b783487 80
fabiombed 8:144855fe02bd 81 const unsigned LENGTH_OF_LONG_UUID = 16;
fabiombed 8:144855fe02bd 82 typedef uint16_t ShortUUIDBytes_t;
fabiombed 8:144855fe02bd 83 typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID];
fabiombed 8:144855fe02bd 84
fabiombed 5:76fb6b783487 85 typedef struct {
fabiombed 5:76fb6b783487 86 int32_t AXIS_X;
fabiombed 5:76fb6b783487 87 int32_t AXIS_Y;
fabiombed 5:76fb6b783487 88 int32_t AXIS_Z;
fabiombed 5:76fb6b783487 89 } AxesRaw_TypeDef;
fabiombed 5:76fb6b783487 90
fabiombed 5:76fb6b783487 91 typedef enum ConnectionStatus_t {
fabiombed 5:76fb6b783487 92 DISCONNECTED =0,
fabiombed 5:76fb6b783487 93 CONNECTED =1
fabiombed 8:144855fe02bd 94 } cns_t;
fabiombed 5:76fb6b783487 95
fabiombed 8:144855fe02bd 96 #define BLE_DEV_NAME "SunTracker"
fabiombed 14:644f9e7278e9 97 #define BLE_DEV_MAC 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF // must be the same of BLE_peer_address_BE into CLIENT
fabiombed 14:644f9e7278e9 98 //#define BLE_DEV_MAC 0xFD,0x66,0x05,0x13,0xBE,0xBA // Default ST
fabiombed 8:144855fe02bd 99 #define BLE_ADVERTISING_INTERVAL 1000
fabiombed 5:76fb6b783487 100
fabiombed 5:76fb6b783487 101 #include "CustomControlService.h"
fabiombed 5:76fb6b783487 102 #include "CustomSensorsService.h"
fabiombed 5:76fb6b783487 103
fabiombed 6:4cbf7303b496 104 static BLE *p_BLEdev = NULL;
fabiombed 7:54984d031243 105 static CustomControlService *p_customcontrolservice = NULL;
fabiombed 7:54984d031243 106 static CustomSensorService *p_customsensorservice = NULL;
fabiombed 7:54984d031243 107
fabiombed 14:644f9e7278e9 108 #endif
fabiombed 14:644f9e7278e9 109
fabiombed 0:becf0d313663 110 /* Definitions ---------------------------------------------------------------*/
fabiombed 0:becf0d313663 111
fabiombed 1:8f312c1686b6 112 #define SET_ACC 400 // Set Motor Acceleration
fabiombed 1:8f312c1686b6 113 #define SET_DEC 400 // Set Motor Deceleration
fabiombed 1:8f312c1686b6 114 #define SET_MAX 200 // Set Motor MaxSpeed
fabiombed 1:8f312c1686b6 115 #define SET_MIN 100 // Set Motor MinSpeed
fabiombed 1:8f312c1686b6 116 #define STOP 1000 // Set Motor Stop Position
fabiombed 1:8f312c1686b6 117 #define TOLLERANCE 100 // Tollerance between Left and Right before Start Movement
fabiombed 1:8f312c1686b6 118 #define RANGE_1 200 // Range 1 for Motor Speed
fabiombed 1:8f312c1686b6 119 #define RANGE_2 500 // Range 2 for Motor Speed
fabiombed 0:becf0d313663 120
fabiombed 0:becf0d313663 121 /* Variables -----------------------------------------------------------------*/
fabiombed 0:becf0d313663 122
fabiombed 14:644f9e7278e9 123 int8_t dir=0; // Motor Rotation Direction: 0 = Stop, 1 = Anticlockwise, 2 = Clockwise
fabiombed 14:644f9e7278e9 124 int8_t changedir=0; // Change Direction: 0 = No, 1 = Yes
fabiombed 14:644f9e7278e9 125 int8_t arrest=0; // Arrest: 0 = No, 1 = Yes
fabiombed 14:644f9e7278e9 126 int32_t babybear=0; // Difference (in Lux) between Left and Right
fabiombed 14:644f9e7278e9 127 int32_t acc_data[3]; // Difference of Accelerometer
fabiombed 14:644f9e7278e9 128 int32_t diff=0; // Babybear or Accelerometer difference [--> Send BLE]
fabiombed 14:644f9e7278e9 129 int32_t diff_abs=0; // Abs of Babybear or Accelerometer difference
fabiombed 14:644f9e7278e9 130 int8_t left=0; // Left Command for Rotate Direction
fabiombed 14:644f9e7278e9 131 int8_t right=0; // Right Command for Rotate Direction
fabiombed 14:644f9e7278e9 132 int8_t start=0; // Waiting User Button Push
fabiombed 14:644f9e7278e9 133 int32_t pos=0; // Motor Position [--> Send BLE]
fabiombed 14:644f9e7278e9 134 int32_t measure=0; // ADC Value from SunPanel [--> Send BLE]
fabiombed 14:644f9e7278e9 135 char DisplayStr[5]; // Status Display
fabiombed 14:644f9e7278e9 136 int8_t Display=0; // Shown on Display: 0 = Motor Speed, 1 = Solar Panel Value, 2 = Manual Control [--> Send BLE]
fabiombed 1:8f312c1686b6 137 int16_t status, status_t, status_b, status_l, status_r; // Babybear Status
fabiombed 1:8f312c1686b6 138
fabiombed 8:144855fe02bd 139 /* Initializations ------------------------------------------------------------*/
fabiombed 8:144855fe02bd 140
fabiombed 8:144855fe02bd 141 // Initializing SPI bus
fabiombed 8:144855fe02bd 142 DevSPI dev_spi(D11, D12, D13);
fabiombed 8:144855fe02bd 143
fabiombed 8:144855fe02bd 144 // Initializing I2C bus
fabiombed 8:144855fe02bd 145 DevI2C dev_i2c(D14, D15);
fabiombed 8:144855fe02bd 146
fabiombed 14:644f9e7278e9 147 #ifdef FlightSense
fabiombed 14:644f9e7278e9 148 // Initializing FlightSense Component 6180XA1
fabiombed 8:144855fe02bd 149 static X_NUCLEO_6180XA1 *board;
fabiombed 8:144855fe02bd 150 MeasureData_t data_sensor_top, data_sensor_bottom, data_sensor_left, data_sensor_right;
fabiombed 14:644f9e7278e9 151 #endif
fabiombed 14:644f9e7278e9 152
fabiombed 14:644f9e7278e9 153 #ifdef EasySpin
fabiombed 14:644f9e7278e9 154 // Initializing EasySpin Component IHM01A1
fabiombed 14:644f9e7278e9 155 static L6474 *motor;
fabiombed 14:644f9e7278e9 156 #endif
fabiombed 14:644f9e7278e9 157
fabiombed 14:644f9e7278e9 158 #ifdef Sensors
fabiombed 14:644f9e7278e9 159 // Initializing Sensors Component IKS01A1
fabiombed 8:144855fe02bd 160 static X_NUCLEO_IKS01A1 *mems;
fabiombed 8:144855fe02bd 161 MotionSensor *accelerometer;
fabiombed 14:644f9e7278e9 162 #endif
fabiombed 8:144855fe02bd 163
fabiombed 8:144855fe02bd 164 InterruptIn mybutton(USER_BUTTON);
fabiombed 8:144855fe02bd 165
fabiombed 14:644f9e7278e9 166 AnalogIn analog_read(PC_3); // A1 Conflict with BLE SPI_CS --> Changed in Morpho PC_3
fabiombed 8:144855fe02bd 167
fabiombed 8:144855fe02bd 168 /* User_Button_Pressed -------------------------------------------------------*/
fabiombed 8:144855fe02bd 169
fabiombed 14:644f9e7278e9 170 void User_Button_Pressed(void)
fabiombed 8:144855fe02bd 171 {
fabiombed 8:144855fe02bd 172
fabiombed 8:144855fe02bd 173 if (start>0) { Display++; }
fabiombed 14:644f9e7278e9 174 #ifdef Sensors
fabiombed 8:144855fe02bd 175 if (Display>2) { Display=0; }
fabiombed 14:644f9e7278e9 176 #else
fabiombed 14:644f9e7278e9 177 if (Display>1) { Display=0; }
fabiombed 14:644f9e7278e9 178 #endif
fabiombed 8:144855fe02bd 179 if (start==0) { start=1; }
fabiombed 14:644f9e7278e9 180
fabiombed 14:644f9e7278e9 181 char State[12]; // Characters into State must be <12 and never =>12 or it crash!!!
fabiombed 14:644f9e7278e9 182 if (Display==0) strcpy(State,"FlightSense");
fabiombed 14:644f9e7278e9 183 if (Display==1) strcpy(State,"ADCSunPanel");
fabiombed 14:644f9e7278e9 184 if (Display==2) strcpy(State,"Sensors");
fabiombed 14:644f9e7278e9 185 printf("\r\n\r\nPUSH Display: %s", State);
fabiombed 8:144855fe02bd 186
fabiombed 8:144855fe02bd 187 }
fabiombed 8:144855fe02bd 188
fabiombed 14:644f9e7278e9 189 #ifdef Ble
fabiombed 14:644f9e7278e9 190
fabiombed 9:ca289bf57f52 191 /* Bluetooth CallBack ---------------------------------------------------------*/
fabiombed 9:ca289bf57f52 192
fabiombed 9:ca289bf57f52 193 static void onUpdatesEnabledCallback(GattAttribute::Handle_t handle)
fabiombed 9:ca289bf57f52 194 {
fabiombed 9:ca289bf57f52 195
fabiombed 9:ca289bf57f52 196 }
fabiombed 9:ca289bf57f52 197
fabiombed 9:ca289bf57f52 198 static void onUpdatesDisabledCallback(Gap::Handle_t handle)
fabiombed 9:ca289bf57f52 199 {
fabiombed 9:ca289bf57f52 200
fabiombed 9:ca289bf57f52 201 }
fabiombed 9:ca289bf57f52 202
fabiombed 9:ca289bf57f52 203 static void onDataReadCallback(const GattReadCallbackParams *eventDataP)
fabiombed 9:ca289bf57f52 204 {
fabiombed 9:ca289bf57f52 205
fabiombed 9:ca289bf57f52 206 }
fabiombed 9:ca289bf57f52 207
fabiombed 14:644f9e7278e9 208 // This Callback happen when it RECEIVE a WRITE
fabiombed 9:ca289bf57f52 209 static void myonDataWriteCallback(const GattWriteCallbackParams *eventDataP)
fabiombed 14:644f9e7278e9 210 {
fabiombed 14:644f9e7278e9 211 //printf ("myonDataWriteCallback attr_handle: %x att_data[3]: %x data_length: %d\n\r", eventDataP->handle, eventDataP->data[3], eventDataP->len );
fabiombed 9:ca289bf57f52 212
fabiombed 9:ca289bf57f52 213 if (p_customcontrolservice->isContHandle(eventDataP->handle)) // Only if write come from this Service
fabiombed 9:ca289bf57f52 214 {
fabiombed 14:644f9e7278e9 215 // Receive 8 byte: data[0] + data[1] + data[2] + data[3]
fabiombed 14:644f9e7278e9 216 printf("\r\n\r\nmyonDataWriteCallback (data[0] %x)", eventDataP->data[0]);
fabiombed 14:644f9e7278e9 217 printf("\r\nmyonDataWriteCallback (data[1] %x)", eventDataP->data[1]);
fabiombed 14:644f9e7278e9 218 printf("\r\nmyonDataWriteCallback (data[2] %x)", eventDataP->data[2]);
fabiombed 14:644f9e7278e9 219 printf("\r\nmyonDataWriteCallback (data[3] %x)", eventDataP->data[3]);
fabiombed 14:644f9e7278e9 220 printf("\r\nmyonDataWriteCallback (data %d)", eventDataP->data[0]+eventDataP->data[1]+eventDataP->data[2]+eventDataP->data[3]);
fabiombed 14:644f9e7278e9 221
fabiombed 14:644f9e7278e9 222 User_Button_Pressed(); // Change Display Status
fabiombed 9:ca289bf57f52 223 }
fabiombed 9:ca289bf57f52 224 }
fabiombed 9:ca289bf57f52 225
fabiombed 9:ca289bf57f52 226 static void onConnectionCallback(const Gap::ConnectionCallbackParams_t * connectionParams)
fabiombed 9:ca289bf57f52 227 {
fabiombed 14:644f9e7278e9 228 printf("\r\n\r\nonConnectionCallback (Line %d)", __LINE__);
fabiombed 9:ca289bf57f52 229 }
fabiombed 9:ca289bf57f52 230
fabiombed 9:ca289bf57f52 231 static void onDisconnectionCallback(const Gap::DisconnectionCallbackParams_t * disConnectionReason)
fabiombed 9:ca289bf57f52 232 {
fabiombed 14:644f9e7278e9 233 printf("\r\n\r\nonDisconnectionCallback (Line %d)", __LINE__);
fabiombed 9:ca289bf57f52 234 p_BLEdev->gap().startAdvertising();
fabiombed 9:ca289bf57f52 235 }
fabiombed 9:ca289bf57f52 236
fabiombed 14:644f9e7278e9 237 #endif
fabiombed 14:644f9e7278e9 238
fabiombed 9:ca289bf57f52 239 /* Bluetooth Initialization ---------------------------------------------------*/
fabiombed 9:ca289bf57f52 240
fabiombed 9:ca289bf57f52 241 bool BLE_Initialization(void)
fabiombed 9:ca289bf57f52 242 {
fabiombed 9:ca289bf57f52 243
fabiombed 14:644f9e7278e9 244 #ifdef Ble
fabiombed 14:644f9e7278e9 245
fabiombed 9:ca289bf57f52 246 p_BLEdev = new BLE;
fabiombed 9:ca289bf57f52 247 if (!p_BLEdev) { printf("\r\nBLE Device creation failed\r\n"); }
fabiombed 9:ca289bf57f52 248 const Gap::Address_t BLE_address_BE = {BLE_DEV_MAC};
fabiombed 9:ca289bf57f52 249 p_BLEdev->gap().setAddress(BLEProtocol::AddressType::PUBLIC, BLE_address_BE);
fabiombed 9:ca289bf57f52 250
fabiombed 9:ca289bf57f52 251 p_BLEdev->init();
fabiombed 9:ca289bf57f52 252
fabiombed 9:ca289bf57f52 253 // Set BLE CallBack Functions
fabiombed 9:ca289bf57f52 254 p_BLEdev->gattServer().onUpdatesEnabled(onUpdatesEnabledCallback);
fabiombed 9:ca289bf57f52 255 p_BLEdev->gattServer().onUpdatesDisabled(onUpdatesDisabledCallback);
fabiombed 9:ca289bf57f52 256 p_BLEdev->gattServer().onDataRead(onDataReadCallback);
fabiombed 9:ca289bf57f52 257 p_BLEdev->gattServer().onDataWritten(myonDataWriteCallback);
fabiombed 9:ca289bf57f52 258 p_BLEdev->gap().onConnection(onConnectionCallback);
fabiombed 9:ca289bf57f52 259 p_BLEdev->gap().onDisconnection(onDisconnectionCallback);
fabiombed 9:ca289bf57f52 260 //p_BLEdev->gattServer().onConfirmationReceived(onConfirmationReceivedCallback);
fabiombed 9:ca289bf57f52 261 //p_BLEdev->gattServer().onDataSent(onDataSentCallback);
fabiombed 9:ca289bf57f52 262 //p_BLEdev->gap().onTimeout(onTimeoutCallback);
fabiombed 9:ca289bf57f52 263
fabiombed 9:ca289bf57f52 264 // BLE Services
fabiombed 14:644f9e7278e9 265 p_customcontrolservice = new CustomControlService(*p_BLEdev);
fabiombed 9:ca289bf57f52 266 p_customsensorservice = new CustomSensorService(*p_BLEdev);
fabiombed 9:ca289bf57f52 267
fabiombed 9:ca289bf57f52 268 // Setup BLE Advertising
fabiombed 9:ca289bf57f52 269 const static char DEVICE_NAME[] = BLE_DEV_NAME;
fabiombed 9:ca289bf57f52 270 p_BLEdev->gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
fabiombed 9:ca289bf57f52 271 uint8_t dat[] = {0x01,0x80,0x00,0xFC,0x00,0x00};
fabiombed 9:ca289bf57f52 272 p_BLEdev->gap().accumulateScanResponse(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA,dat,6);
fabiombed 9:ca289bf57f52 273 p_BLEdev->gap().accumulateAdvertisingPayload(GapAdvertisingData::UNKNOWN);
fabiombed 9:ca289bf57f52 274 p_BLEdev->gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
fabiombed 9:ca289bf57f52 275 p_BLEdev->gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
fabiombed 9:ca289bf57f52 276 p_BLEdev->gap().setAdvertisingInterval(BLE_ADVERTISING_INTERVAL);
fabiombed 9:ca289bf57f52 277 p_BLEdev->gap().startAdvertising();
fabiombed 9:ca289bf57f52 278
fabiombed 14:644f9e7278e9 279 printf("Initialization Ble OK (Line %d)\r\n", __LINE__);
fabiombed 14:644f9e7278e9 280
fabiombed 14:644f9e7278e9 281 #endif
fabiombed 14:644f9e7278e9 282
fabiombed 9:ca289bf57f52 283 return true;
fabiombed 9:ca289bf57f52 284
fabiombed 9:ca289bf57f52 285 }
fabiombed 9:ca289bf57f52 286
fabiombed 8:144855fe02bd 287 /* Initialization ------------------------------------------------------------*/
fabiombed 8:144855fe02bd 288
fabiombed 8:144855fe02bd 289 bool Initialization(void)
fabiombed 8:144855fe02bd 290 {
fabiombed 11:b5e23d64d366 291
fabiombed 14:644f9e7278e9 292 dev_i2c.frequency(100000); // Default 100KHz. At 10KHz, 20KHz, 200KHz and 400KHz doesn't work
fabiombed 11:b5e23d64d366 293
fabiombed 11:b5e23d64d366 294 //----
fabiombed 14:644f9e7278e9 295
fabiombed 14:644f9e7278e9 296 #ifdef FlightSense
fabiombed 14:644f9e7278e9 297
fabiombed 14:644f9e7278e9 298 // Initializing FlightSense Component
fabiombed 14:644f9e7278e9 299 board=X_NUCLEO_6180XA1::Instance(&dev_i2c, NC, NC, NC, NC); // NC as Interrupt fixed from FlightSense library 42
fabiombed 14:644f9e7278e9 300
fabiombed 9:ca289bf57f52 301 status=board->InitBoard();
fabiombed 9:ca289bf57f52 302 if(status) VL6180x_ErrLog("Failed to init the board!\n\r");
fabiombed 8:144855fe02bd 303
fabiombed 8:144855fe02bd 304 // Put GPIO not used as Interrupt in Hi-Z
fabiombed 8:144855fe02bd 305 status_t=board->sensor_top->SetGPIOxFunctionality(1, GPIOx_SELECT_OFF);
fabiombed 14:644f9e7278e9 306 //status_b=board->sensor_botton->SetGPIOxFunctionality(1, GPIOx_SELECT_OFF); Not Present
fabiombed 8:144855fe02bd 307 status_l=board->sensor_left->SetGPIOxFunctionality(1, GPIOx_SELECT_OFF);
fabiombed 8:144855fe02bd 308 status_r=board->sensor_right->SetGPIOxFunctionality(1, GPIOx_SELECT_OFF);
fabiombed 8:144855fe02bd 309
fabiombed 8:144855fe02bd 310 // Set Babybears
fabiombed 8:144855fe02bd 311 status_l=board->sensor_left->AlsSetAnalogueGain(3);
fabiombed 8:144855fe02bd 312 status_r=board->sensor_right->AlsSetAnalogueGain(3);
fabiombed 8:144855fe02bd 313 status_l=board->sensor_left->StartMeasurement(als_continuous_polling, NULL, NULL, NULL);
fabiombed 8:144855fe02bd 314 status_r=board->sensor_right->StartMeasurement(als_continuous_polling, NULL, NULL, NULL);
fabiombed 8:144855fe02bd 315
fabiombed 14:644f9e7278e9 316 printf("Init FlightSense OK\r\n");
fabiombed 14:644f9e7278e9 317
fabiombed 14:644f9e7278e9 318 #endif
fabiombed 11:b5e23d64d366 319
fabiombed 8:144855fe02bd 320 //----
fabiombed 8:144855fe02bd 321
fabiombed 14:644f9e7278e9 322 #ifdef EasySpin
fabiombed 11:b5e23d64d366 323
fabiombed 14:644f9e7278e9 324 // Initializing EasySpin Component
fabiombed 9:ca289bf57f52 325 motor = new L6474(D2, D8, PB_2, D9, D10, dev_spi); // D7 conflict with BNRG_RST (when motor change direction 0-1 reset BLE)
fabiombed 9:ca289bf57f52 326 // Used Morpho PB_2 and made HW wiring
fabiombed 8:144855fe02bd 327 if (motor->Init(NULL) != COMPONENT_OK)
fabiombed 8:144855fe02bd 328 return false;
fabiombed 8:144855fe02bd 329
fabiombed 8:144855fe02bd 330 motor->SetStepMode(STEP_MODE_1_8); // Default is STEP_MODE_1_16
fabiombed 8:144855fe02bd 331
fabiombed 8:144855fe02bd 332 // Set defaults Motor Speed
fabiombed 8:144855fe02bd 333 motor->SetAcceleration(SET_ACC);
fabiombed 8:144855fe02bd 334 motor->SetDeceleration(SET_DEC);
fabiombed 8:144855fe02bd 335 motor->SetMaxSpeed(SET_MAX); // Variable by Light/Mems Sensors
fabiombed 8:144855fe02bd 336 motor->SetMinSpeed(SET_MIN);
fabiombed 8:144855fe02bd 337
fabiombed 14:644f9e7278e9 338 printf("Init EasySpin OK\r\n");
fabiombed 14:644f9e7278e9 339
fabiombed 14:644f9e7278e9 340 #endif
fabiombed 14:644f9e7278e9 341
fabiombed 14:644f9e7278e9 342 //----
fabiombed 14:644f9e7278e9 343
fabiombed 14:644f9e7278e9 344 #ifdef Sensors
fabiombed 11:b5e23d64d366 345
fabiombed 14:644f9e7278e9 346 // Initializing Sensors Component
fabiombed 14:644f9e7278e9 347 mems=X_NUCLEO_IKS01A1::Instance(&dev_i2c);
fabiombed 14:644f9e7278e9 348 accelerometer = mems->GetAccelerometer();
fabiombed 14:644f9e7278e9 349
fabiombed 14:644f9e7278e9 350 printf("Init Sensors OK\r\n");
fabiombed 14:644f9e7278e9 351
fabiombed 14:644f9e7278e9 352 #endif
fabiombed 14:644f9e7278e9 353
fabiombed 14:644f9e7278e9 354 printf("Initialization OK (Line %d)\r\n", __LINE__);
fabiombed 8:144855fe02bd 355 return true;
fabiombed 8:144855fe02bd 356
fabiombed 8:144855fe02bd 357 }
fabiombed 8:144855fe02bd 358
fabiombed 8:144855fe02bd 359 /* Measure_Babybear ----------------------------------------------------------*/
fabiombed 8:144855fe02bd 360
fabiombed 8:144855fe02bd 361 void Measure_Babybear(void)
fabiombed 8:144855fe02bd 362 {
fabiombed 8:144855fe02bd 363
fabiombed 14:644f9e7278e9 364 #ifdef FlightSense
fabiombed 14:644f9e7278e9 365
fabiombed 8:144855fe02bd 366 status_l=board->sensor_left->GetMeasurement(als_continuous_polling, &data_sensor_left);
fabiombed 8:144855fe02bd 367 status_r=board->sensor_right->GetMeasurement(als_continuous_polling, &data_sensor_right);
fabiombed 8:144855fe02bd 368
fabiombed 8:144855fe02bd 369 babybear = data_sensor_right.lux - data_sensor_left.lux;
fabiombed 8:144855fe02bd 370
fabiombed 14:644f9e7278e9 371 diff = babybear;
fabiombed 1:8f312c1686b6 372
fabiombed 14:644f9e7278e9 373 #endif
fabiombed 8:144855fe02bd 374
fabiombed 8:144855fe02bd 375 }
fabiombed 8:144855fe02bd 376
fabiombed 8:144855fe02bd 377 /* Measure_Accelerometer -----------------------------------------------------*/
fabiombed 8:144855fe02bd 378
fabiombed 8:144855fe02bd 379 void Measure_Accelerometer(void)
fabiombed 8:144855fe02bd 380 {
fabiombed 8:144855fe02bd 381
fabiombed 14:644f9e7278e9 382 #ifdef Sensors
fabiombed 14:644f9e7278e9 383
fabiombed 8:144855fe02bd 384 accelerometer->Get_X_Axes(acc_data);
fabiombed 8:144855fe02bd 385
fabiombed 14:644f9e7278e9 386 diff = acc_data[0];
fabiombed 8:144855fe02bd 387
fabiombed 14:644f9e7278e9 388 #endif
fabiombed 8:144855fe02bd 389
fabiombed 8:144855fe02bd 390 }
fabiombed 8:144855fe02bd 391
fabiombed 8:144855fe02bd 392 /* Control_Motor -------------------------------------------------------------*/
fabiombed 8:144855fe02bd 393
fabiombed 8:144855fe02bd 394 void Control_Motor(void)
fabiombed 8:144855fe02bd 395 {
fabiombed 8:144855fe02bd 396
fabiombed 14:644f9e7278e9 397 #ifdef EasySpin
fabiombed 14:644f9e7278e9 398
fabiombed 14:644f9e7278e9 399 diff_abs = abs(diff);
fabiombed 8:144855fe02bd 400
fabiombed 14:644f9e7278e9 401 //printf("Diff: %d lux/mems\n\r", diff_abs);
fabiombed 14:644f9e7278e9 402 motor->SetMaxSpeed(diff_abs);
fabiombed 14:644f9e7278e9 403
fabiombed 14:644f9e7278e9 404 if (diff>0) { left=0; right=1; }
fabiombed 14:644f9e7278e9 405 if (diff<0) { left=1; right=0; }
fabiombed 14:644f9e7278e9 406
fabiombed 14:644f9e7278e9 407 if (diff_abs>TOLLERANCE) {
fabiombed 14:644f9e7278e9 408 if (diff_abs <=RANGE_1)
fabiombed 8:144855fe02bd 409 {
fabiombed 8:144855fe02bd 410 if (left) { strcpy(DisplayStr,"E___"); }
fabiombed 8:144855fe02bd 411 if (right) { strcpy(DisplayStr,"___3"); }
fabiombed 8:144855fe02bd 412 }
fabiombed 14:644f9e7278e9 413 else if (diff_abs >RANGE_1 & diff_abs <=RANGE_2)
fabiombed 8:144855fe02bd 414 {
fabiombed 8:144855fe02bd 415 if (left) { strcpy(DisplayStr,"E==="); }
fabiombed 8:144855fe02bd 416 if (right) { strcpy(DisplayStr,"===3"); }
fabiombed 8:144855fe02bd 417 }
fabiombed 14:644f9e7278e9 418 else if (diff_abs >RANGE_2)
fabiombed 8:144855fe02bd 419 {
fabiombed 8:144855fe02bd 420 if (left) { strcpy(DisplayStr,"E~~~"); }
fabiombed 8:144855fe02bd 421 if (right) { strcpy(DisplayStr,"~~~3"); }
fabiombed 8:144855fe02bd 422 }
fabiombed 8:144855fe02bd 423
fabiombed 8:144855fe02bd 424 // In Case of Change Direction
fabiombed 8:144855fe02bd 425 if (left & dir==2) { changedir=1; }
fabiombed 8:144855fe02bd 426 if (right & dir==1) { changedir=1; }
fabiombed 0:becf0d313663 427
fabiombed 8:144855fe02bd 428 // Run only if Stop or Change Direction
fabiombed 14:644f9e7278e9 429 if (diff_abs>TOLLERANCE & (dir==0 | changedir==1)) {
fabiombed 8:144855fe02bd 430 if (left) { motor->Run(StepperMotor::FWD); dir=1; changedir=0; }
fabiombed 8:144855fe02bd 431 if (right) { motor->Run(StepperMotor::BWD); dir=2; changedir=0; }
fabiombed 14:644f9e7278e9 432 printf("\n\rRUN");
fabiombed 8:144855fe02bd 433 }
fabiombed 8:144855fe02bd 434 }
fabiombed 8:144855fe02bd 435
fabiombed 8:144855fe02bd 436 // Get Motor Position and Control Rotation Block
fabiombed 8:144855fe02bd 437 pos = motor->GetPosition();
fabiombed 8:144855fe02bd 438 if (pos>STOP | pos<-STOP) {
fabiombed 8:144855fe02bd 439 if (pos>0) { motor->GoTo(STOP); }
fabiombed 8:144855fe02bd 440 if (pos<0) { motor->GoTo(-STOP); }
fabiombed 14:644f9e7278e9 441 printf("\n\rGOTO");
fabiombed 8:144855fe02bd 442 }
fabiombed 1:8f312c1686b6 443
fabiombed 8:144855fe02bd 444 // Stop Motor
fabiombed 14:644f9e7278e9 445 if (diff_abs<=TOLLERANCE) {
fabiombed 8:144855fe02bd 446 arrest=1;
fabiombed 8:144855fe02bd 447 if (Display==0) { strcpy(DisplayStr,"----"); }
fabiombed 8:144855fe02bd 448 if (Display==2) { strcpy(DisplayStr,"E 3"); }
fabiombed 8:144855fe02bd 449 }
fabiombed 8:144855fe02bd 450
fabiombed 8:144855fe02bd 451 if (arrest==1 && dir!=0 ) { // Stop just one time
fabiombed 8:144855fe02bd 452 motor->HardStop();
fabiombed 8:144855fe02bd 453 dir=0;
fabiombed 8:144855fe02bd 454 changedir=0;
fabiombed 8:144855fe02bd 455 arrest=0;
fabiombed 14:644f9e7278e9 456 printf("\n\rSTOP");
fabiombed 8:144855fe02bd 457 }
fabiombed 8:144855fe02bd 458
fabiombed 14:644f9e7278e9 459 #endif
fabiombed 14:644f9e7278e9 460
fabiombed 8:144855fe02bd 461 }
fabiombed 8:144855fe02bd 462
fabiombed 8:144855fe02bd 463 /* Measure_SolarPanel --------------------------------------------------------*/
fabiombed 8:144855fe02bd 464
fabiombed 8:144855fe02bd 465 void Measure_SolarPanel(void)
fabiombed 8:144855fe02bd 466 {
fabiombed 8:144855fe02bd 467
fabiombed 8:144855fe02bd 468 // AnalogIn: 0V return 0.0 , 3.3V return 1.0
fabiombed 14:644f9e7278e9 469 measure = analog_read.read() * 3300;
fabiombed 8:144855fe02bd 470 //printf("Measure = %.0f mV\r\n", measure);
fabiombed 8:144855fe02bd 471 //board->display->DisplayDigit("A", 0);
fabiombed 8:144855fe02bd 472
fabiombed 14:644f9e7278e9 473 if (Display==1) { sprintf(DisplayStr, "%d", measure); }
fabiombed 14:644f9e7278e9 474
fabiombed 8:144855fe02bd 475 }
fabiombed 1:8f312c1686b6 476
fabiombed 8:144855fe02bd 477 /* Main ----------------------------------------------------------------------*/
fabiombed 8:144855fe02bd 478
fabiombed 8:144855fe02bd 479 int main()
fabiombed 8:144855fe02bd 480 {
fabiombed 8:144855fe02bd 481
fabiombed 8:144855fe02bd 482 // Printing to the console
fabiombed 14:644f9e7278e9 483 printf("\r\n\r\nSunTracker by Fabio Brembilla\r\n\r\n");
fabiombed 11:b5e23d64d366 484
fabiombed 8:144855fe02bd 485 Initialization();
fabiombed 14:644f9e7278e9 486 BLE_Initialization();
fabiombed 7:54984d031243 487
fabiombed 8:144855fe02bd 488 mybutton.fall(&User_Button_Pressed);
fabiombed 7:54984d031243 489
fabiombed 8:144855fe02bd 490 // Loop until push User Button to Set 0 Point
fabiombed 14:644f9e7278e9 491 printf("\r\nWait PUSH Button");
fabiombed 8:144855fe02bd 492 strcpy(DisplayStr,"pusH");
fabiombed 8:144855fe02bd 493 while(start<1) {
fabiombed 14:644f9e7278e9 494 #ifdef FlightSense
fabiombed 8:144855fe02bd 495 board->display->DisplayString(DisplayStr, 4);
fabiombed 14:644f9e7278e9 496 p_BLEdev->waitForEvent();
fabiombed 8:144855fe02bd 497 //printf("%s\n\r", DisplayStr);
fabiombed 14:644f9e7278e9 498 #endif
fabiombed 8:144855fe02bd 499 }
fabiombed 4:1d3d071a4c2c 500
fabiombed 14:644f9e7278e9 501 printf("\r\n\r\nStart Main Loop");
fabiombed 6:4cbf7303b496 502
fabiombed 14:644f9e7278e9 503 #ifdef EasySpin
fabiombed 14:644f9e7278e9 504 motor->Enable(); // To put the motor on hold by execute CmdEnable
fabiombed 14:644f9e7278e9 505 #endif
fabiombed 10:d154094297ce 506
fabiombed 14:644f9e7278e9 507 #ifdef Ble
fabiombed 11:b5e23d64d366 508 static int INTLOOP=0;
fabiombed 14:644f9e7278e9 509 #endif
fabiombed 7:54984d031243 510
fabiombed 6:4cbf7303b496 511 // Main Loop
fabiombed 8:144855fe02bd 512 while(true)
fabiombed 8:144855fe02bd 513 {
fabiombed 8:144855fe02bd 514 if (Display==0 | Display==1) { Measure_Babybear(); }
fabiombed 8:144855fe02bd 515 if (Display==2) { Measure_Accelerometer(); }
fabiombed 8:144855fe02bd 516
fabiombed 8:144855fe02bd 517 Control_Motor();
fabiombed 8:144855fe02bd 518 Measure_SolarPanel();
fabiombed 14:644f9e7278e9 519
fabiombed 14:644f9e7278e9 520 #ifdef FlightSense
fabiombed 14:644f9e7278e9 521 board->display->DisplayString(DisplayStr, 4);
fabiombed 14:644f9e7278e9 522 //printf("%s\n\r", DisplayStr);
fabiombed 14:644f9e7278e9 523 #endif
fabiombed 14:644f9e7278e9 524
fabiombed 14:644f9e7278e9 525 #ifdef Ble
fabiombed 11:b5e23d64d366 526 INTLOOP++;
fabiombed 14:644f9e7278e9 527 //if (INTLOOP==100) { p_customsensorservice->sendEnvPosition(rand(),0); printf("Read BLE\n\r"); INTLOOP=0; }
fabiombed 14:644f9e7278e9 528 if (INTLOOP==100)
fabiombed 14:644f9e7278e9 529 {
fabiombed 14:644f9e7278e9 530 printf("\n\r\n\rSend BLE Display %d", Display);
fabiombed 14:644f9e7278e9 531 //p_customcontrolservice->sendControlState(Display);
fabiombed 14:644f9e7278e9 532 p_customcontrolservice->updateControlState(Display);
fabiombed 14:644f9e7278e9 533
fabiombed 14:644f9e7278e9 534 printf("\n\rSend BLE Difference %d lux/mems", diff); // Send BLE diff, no diff_abs
fabiombed 14:644f9e7278e9 535 //p_customsensorservice->sendEnvDifference(diff);
fabiombed 14:644f9e7278e9 536 p_customsensorservice->updateEnvDifference(diff);
fabiombed 14:644f9e7278e9 537
fabiombed 14:644f9e7278e9 538 printf("\n\rSend BLE Position %d", pos);
fabiombed 14:644f9e7278e9 539 //p_customsensorservice->sendEnvPosition(pos);
fabiombed 14:644f9e7278e9 540 p_customsensorservice->updateEnvPosition(pos);
fabiombed 14:644f9e7278e9 541
fabiombed 14:644f9e7278e9 542 printf("\n\rSend BLE Sunpanel %d mV", measure);
fabiombed 14:644f9e7278e9 543 //p_customsensorservice->sendEnvSunpanel(measure);
fabiombed 14:644f9e7278e9 544 p_customsensorservice->updateEnvSunpanel(measure);
fabiombed 14:644f9e7278e9 545
fabiombed 14:644f9e7278e9 546 INTLOOP=0;
fabiombed 14:644f9e7278e9 547 }
fabiombed 14:644f9e7278e9 548
fabiombed 11:b5e23d64d366 549 p_BLEdev->waitForEvent();
fabiombed 14:644f9e7278e9 550 #endif
fabiombed 8:144855fe02bd 551 }
fabiombed 4:1d3d071a4c2c 552
fabiombed 8:144855fe02bd 553 //status_l=board->sensor_left->StopMeasurement(als_continuous_polling);
fabiombed 8:144855fe02bd 554 //status_r=board->sensor_right->StopMeasurement(als_continuous_polling);
fabiombed 4:1d3d071a4c2c 555
fabiombed 14:644f9e7278e9 556 }