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.
main.cpp@5:2d1980c7ca2d, 2017-04-14 (annotated)
- Committer:
- bcostm
- Date:
- Fri Apr 14 14:35:49 2017 +0200
- Revision:
- 5:2d1980c7ca2d
- Parent:
- 0:280450d2b3cc
- Child:
- 6:ff641476ffe3
Add LEDs demo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:280450d2b3cc | 1 | #include "mbed.h" |
bcostm | 0:280450d2b3cc | 2 | |
bcostm | 0:280450d2b3cc | 3 | DigitalOut led1(LED1); |
bcostm | 5:2d1980c7ca2d | 4 | DigitalOut led2(LED2); |
bcostm | 5:2d1980c7ca2d | 5 | // This object drives both LD3 and LD4 on the board. |
bcostm | 5:2d1980c7ca2d | 6 | // Only one of these LEDs can be driven at a time. |
bcostm | 5:2d1980c7ca2d | 7 | DigitalInOut led3(LED3); |
bcostm | 5:2d1980c7ca2d | 8 | |
bcostm | 5:2d1980c7ca2d | 9 | #define LD1_ON {led1 = 1;} |
bcostm | 5:2d1980c7ca2d | 10 | #define LD1_OFF {led1 = 0;} |
bcostm | 5:2d1980c7ca2d | 11 | #define LD2_ON {led2 = 1;} |
bcostm | 5:2d1980c7ca2d | 12 | #define LD2_OFF {led2 = 0;} |
bcostm | 5:2d1980c7ca2d | 13 | #define LD3_ON {led3.output(); led3 = 1;} |
bcostm | 5:2d1980c7ca2d | 14 | #define LD3LD4_OFF {led3.input();} |
bcostm | 5:2d1980c7ca2d | 15 | #define LD4_ON {led3.output(); led3 = 0;} |
bcostm | 5:2d1980c7ca2d | 16 | |
bcostm | 5:2d1980c7ca2d | 17 | // Select your demo |
bcostm | 5:2d1980c7ca2d | 18 | #define DEMO1_LEDS |
bcostm | 0:280450d2b3cc | 19 | |
bcostm | 0:280450d2b3cc | 20 | int main() |
bcostm | 0:280450d2b3cc | 21 | { |
bcostm | 5:2d1980c7ca2d | 22 | #ifdef DEMO1_LEDS |
bcostm | 0:280450d2b3cc | 23 | while(1) { |
bcostm | 5:2d1980c7ca2d | 24 | LD1_ON; |
bcostm | 5:2d1980c7ca2d | 25 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 26 | LD2_ON; |
bcostm | 5:2d1980c7ca2d | 27 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 28 | LD3_ON; |
bcostm | 5:2d1980c7ca2d | 29 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 30 | LD4_ON; |
bcostm | 5:2d1980c7ca2d | 31 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 32 | LD1_OFF; |
bcostm | 5:2d1980c7ca2d | 33 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 34 | LD2_OFF; |
bcostm | 5:2d1980c7ca2d | 35 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 36 | LD3LD4_OFF; |
bcostm | 5:2d1980c7ca2d | 37 | wait(0.5); |
bcostm | 5:2d1980c7ca2d | 38 | } |
bcostm | 5:2d1980c7ca2d | 39 | #endif |
bcostm | 5:2d1980c7ca2d | 40 | while(1) { |
bcostm | 0:280450d2b3cc | 41 | } |
bcostm | 0:280450d2b3cc | 42 | } |