Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DHT11 LPS22HB LSM6DSL VL53L0X
Sensors.h
00001 #ifndef SENSORS_H 00002 #define SENSORS_H 00003 00004 //Internal sensors 00005 #include "Dht11.h" //Temperature & humidity sensor 00006 #include "LPS22HBSensor.h" //Pressure sensor 00007 #include "LSM6DSLSensor.h" //Accelerometer & gyroscope 00008 #include "VL53L0X.h" //Proximity sensor 00009 00010 00011 /* For errors while reading values */ 00012 #define VALUE_ERROR -1 00013 int press_status; 00014 00015 /* Interface definition */ 00016 static DevI2C devI2c(PB_11,PB_10); 00017 00018 /* Environment sensors */ 00019 Dht11 hum_temp_s(D4); 00020 DigitalIn light_s(D6); 00021 static LPS22HBSensor press_s(&devI2c); 00022 00023 /* Motion sensors */ 00024 static LSM6DSLSensor acc_gyro(&devI2c,LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW,PD_11); // low address 00025 00026 /* Range sensor - B-L475E-IOT01A2 only */ 00027 static DigitalOut shutdown_pin(PC_6); 00028 static VL53L0X range(&devI2c, &shutdown_pin, PC_7); 00029 00030 /* Variables */ 00031 int mag_axes[3]; 00032 int acc_axes[3]; 00033 int gyro_axes[3]; 00034 unsigned int distance; 00035 float temp; 00036 float hum; 00037 int light; 00038 float press; 00039 00040 /* Functions */ 00041 void enable_sensors(); 00042 void get_values(); 00043 void get_motion_data(int dt, int* speed, int* prev_speed, int* prev_pos, int* prev_angle); 00044 00045 #endif
Generated on Thu Jul 14 2022 07:12:42 by
1.7.2