a sensor hub for monitoring home environment
Dependencies: HTS221 LIS3MDL LPS22HB LSM303AGR LSM6DSL VL53L0X picojson
Fork of HelloWorld_ST_Sensors by
Diff: main.cpp
- Revision:
- 1:0f7838527fef
- Parent:
- 0:6a97487a0ab3
- Child:
- 2:4d4fa82dbc59
--- a/main.cpp Thu Sep 07 12:31:15 2017 +0000 +++ b/main.cpp Fri Sep 08 12:22:48 2017 +0000 @@ -127,7 +127,8 @@ acc_gyro.enable_x(); acc_gyro.enable_g(); - printf("\r\n--- Starting new run ---\r\n"); + printf("\033[2J\033[20A"); + printf ("\r\n--- Starting new run ---\r\n\r\n"); hum_temp.read_id(&id); printf("HTS221 humidity & temperature = 0x%X\r\n", id); @@ -135,12 +136,14 @@ printf("LPS22HB pressure & temperature = 0x%X\r\n", id); magnetometer.read_id(&id); #ifdef TARGET_DISCO_L475VG_IOT01A - printf("LIS3MDL magnetometer = 0x%X\r\n", id); + printf("LIS3MDL magnetometer = 0x%X\r\n", id); #else // X-NUCLEO-IKS01A2 printf("LSM303AGR magnetometer = 0x%X\r\n", id); #endif acc_gyro.read_id(&id); printf("LSM6DSL accelerometer & gyroscope = 0x%X\r\n", id); + + printf("\n\r--- Reading sensor values ---\n\r"); ; while(1) { printf("\r\n"); @@ -157,17 +160,18 @@ magnetometer.get_m_axes(axes); #ifdef TARGET_DISCO_L475VG_IOT01A - printf("LIS3MDL [mag/mgauss]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); + printf("LIS3MDL [mag/mgauss]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); #else // X-NUCLEO-IKS01A2 printf("LSM303AGR [mag/mgauss]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); #endif acc_gyro.get_x_axes(axes); - printf("LSM6DSL [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); + printf("LSM6DSL [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); acc_gyro.get_g_axes(axes); - printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); + printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); - wait(2); + printf("\033[7A"); + wait(1); } }