"Sensors Reader" Sample Application for X-NUCLEO-IKS01A1 Expansion Board
Dependencies: X_NUCLEO_IKS01A1 mbed
Fork of Sensors_Reader by
X-NUCLEO-IKS01A1 MEMS Inertial & Environmental Sensor Nucleo Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-IKS01A1 MEMS Inertial & Environmental Nucleo Expansion Board.
Example Application
First of all, the example application outputs information retrieved from the Expansion Board over UART.
Launch a terminal application (e.g.: PuTTY
on Windows, Minicom
on Linux) and set the UART port to 9600 bps, 8 bit, No Parity,
1 stop bit.
The "Sensors Reader" program is a more complex example of how to use the X-NUCLEO-IKS01A1 expansion board featuring among others:
- Support for LSM6DS3 3D Accelerometer & Gyroscope (on DIL 24-pin socket) including free-fall detection
- Usage of LED & Ticker
- Exploitation of wait for event
- (Top-/Bottom-Half) Interrupt handling
Diff: main.cpp
- Revision:
- 11:e20efb4e8a98
- Parent:
- 5:a1de9dcb0f41
- Child:
- 18:645c96f209c7
--- a/main.cpp Fri May 22 11:45:59 2015 +0200 +++ b/main.cpp Wed May 27 11:56:24 2015 +0200 @@ -127,7 +127,7 @@ static void init(void) { uint8_t hts221_id; - /* Determine ID of Humidity & Tempreture Sensor */ + /* Determine ID of Humidity & Temperature Sensor */ mems_expansion_board->ht_sensor.ReadID(&hts221_id); printf("HTS221_ID = 0x%x (%u)\n", hts221_id, hts221_id); } @@ -137,12 +137,14 @@ float TEMPERATURE_Value; float HUMIDITY_Value; float PRESSURE_Value; + float PRESSURE_Temp_Value; AxesRaw_TypeDef MAG_Value; AxesRaw_TypeDef ACC_Value; AxesRaw_TypeDef GYR_Value; char buffer1[32]; char buffer2[32]; char buffer3[32]; + char buffer4[32]; /* Switch LED On */ myled = LED_ON; @@ -152,15 +154,17 @@ mems_expansion_board->ht_sensor.GetTemperature(&TEMPERATURE_Value); mems_expansion_board->ht_sensor.GetHumidity(&HUMIDITY_Value); mems_expansion_board->pressure_sensor.GetPressure(&PRESSURE_Value); + mems_expansion_board->pressure_sensor.GetTemperature(&PRESSURE_Temp_Value); mems_expansion_board->magnetometer.Get_M_Axes((int32_t *)&MAG_Value); mems_expansion_board->gyroscope.Get_X_Axes((int32_t *)&ACC_Value); mems_expansion_board->gyroscope.Get_G_Axes((int32_t *)&GYR_Value); /* Print Values Out */ - printf("TEMP: %s, HUMIDITY: %s, PRESSURE: %s\n", + printf("TEMP: %s, HUMIDITY: %s, PRESSURE (TEMP): %s (%s)\n", printDouble(buffer1, TEMPERATURE_Value), printDouble(buffer2, HUMIDITY_Value), - printDouble(buffer3, PRESSURE_Value)); + printDouble(buffer3, PRESSURE_Value), + printDouble(buffer4, PRESSURE_Temp_Value)); printf("X_MAG: %ld, Y_MAG: %ld, Z_MAG: %ld\n", MAG_Value.AXIS_X, MAG_Value.AXIS_Y, MAG_Value.AXIS_Z); printf("X_ACC: %ld, Y_ACC: %ld, Z_ACC: %ld\n",