"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
Revision 29:25c8f7d4515a, committed 2015-06-05
- Comitter:
- Wolfgang Betz
- Date:
- Fri Jun 05 16:54:47 2015 +0200
- Parent:
- 28:bd9c2960f8f4
- Child:
- 30:2cb1cb33a6ba
- Child:
- 31:538716fb519c
- Commit message:
- Corrected minor bug in humidity sensor
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jun 03 15:13:40 2015 +0200 +++ b/main.cpp Fri Jun 05 16:54:47 2015 +0200 @@ -165,23 +165,24 @@ temp_sensor1.GetTemperature(&TEMPERATURE_Value); humidity_sensor.GetHumidity(&HUMIDITY_Value); pressure_sensor.GetPressure(&PRESSURE_Value); - temp_sensor2.GetTemperature(&PRESSURE_Temp_Value); + temp_sensor2.GetFahrenheit(&PRESSURE_Temp_Value); magnetometer.Get_M_Axes((int32_t *)&MAG_Value); accelerometer.Get_X_Axes((int32_t *)&ACC_Value); gyroscope.Get_G_Axes((int32_t *)&GYR_Value); /* Print Values Out */ - printf("TEMP: %s, HUMIDITY: %s, PRESSURE (TEMP): %s (%s)\n", + printf(" X Y Z\n"); + printf("MAG [mgauss]: %9ld %9ld %9ld\n", + MAG_Value.AXIS_X, MAG_Value.AXIS_Y, MAG_Value.AXIS_Z); + printf("ACC [mg]: %9ld %9ld %9ld\n", + ACC_Value.AXIS_X, ACC_Value.AXIS_Y, ACC_Value.AXIS_Z); + printf("GYR [mdps]: %9ld %9ld %9ld\n", + GYR_Value.AXIS_X, GYR_Value.AXIS_Y, GYR_Value.AXIS_Z); + printf("---\nTEMP | HUMIDITY: %s°C | %s%%\nTEMP | PRESSURE: %s°F | %smbar\n", printDouble(buffer1, TEMPERATURE_Value), printDouble(buffer2, HUMIDITY_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", - ACC_Value.AXIS_X, ACC_Value.AXIS_Y, ACC_Value.AXIS_Z); - printf("X_GYR: %ld, Y_GYR: %ld, Z_GYR: %ld\n", - GYR_Value.AXIS_X, GYR_Value.AXIS_Y, GYR_Value.AXIS_Z); + printDouble(buffer4, PRESSURE_Temp_Value), + printDouble(buffer3, PRESSURE_Value)); /* Switch LED Off */ myled = LED_OFF;