Read board sensors (temperature, humidity, pressure, gyroscope, accelerometer, magnetometer) using ST BSP drivers. This example is superceded with the HelloWorld_ST_Sensors example.
Dependencies: BSP_B-L475E-IOT01
Information
This example is superceded with the HelloWorld_ST_Sensors example.
Import programHelloWorld_ST_Sensors
Simple application to test ST motion and environmental MEMS sensors. Supports NUCLEO+X-NUCLEO-IKS01A2 , STEVAL-STLKT01V1 (a.k.a. SensorTile) and B-L475E-IOT01A boards.
Diff: main.cpp
- Revision:
- 5:2d1980c7ca2d
- Parent:
- 0:280450d2b3cc
- Child:
- 6:ff641476ffe3
--- a/main.cpp Fri Apr 14 13:42:52 2017 +0200 +++ b/main.cpp Fri Apr 14 14:35:49 2017 +0200 @@ -1,11 +1,42 @@ #include "mbed.h" DigitalOut led1(LED1); +DigitalOut led2(LED2); +// This object drives both LD3 and LD4 on the board. +// Only one of these LEDs can be driven at a time. +DigitalInOut led3(LED3); + +#define LD1_ON {led1 = 1;} +#define LD1_OFF {led1 = 0;} +#define LD2_ON {led2 = 1;} +#define LD2_OFF {led2 = 0;} +#define LD3_ON {led3.output(); led3 = 1;} +#define LD3LD4_OFF {led3.input();} +#define LD4_ON {led3.output(); led3 = 0;} + +// Select your demo +#define DEMO1_LEDS int main() { +#ifdef DEMO1_LEDS while(1) { - led1 = !led1; - wait(1); + LD1_ON; + wait(0.5); + LD2_ON; + wait(0.5); + LD3_ON; + wait(0.5); + LD4_ON; + wait(0.5); + LD1_OFF; + wait(0.5); + LD2_OFF; + wait(0.5); + LD3LD4_OFF; + wait(0.5); + } +#endif + while(1) { } }