You are viewing an older revision! See the latest version
Getting Started with Sensors
Getting Started with Sensors¶
This example will show how an to add sensors to your embedded device using the Grove Base Shield V2 board and a Grove temperature sensor. Various other Grove sensors and input/output modules are available with examples in the mbed community. Contained within the example code are 4 other Grove sensors - accelerometer, light sensor, water sensor, gas sensor.
- First, plug a Grove Shield Boards on to your Nucleo stack
- Next, connect the Grove temperature sensor to connector port A0 of the shield board
- Connect the STM32F411 Nucleo to your PC with a USB cable
Return to mbed and import the “STM32_Read_Sensors_Example” mbed project.
- Go to http://mbed.org/teams/ATT-CTIA-Hackathon-2014/code/STM32_Read_Sensors_Example/ and click the “Import program” button
- Click “Import” button on the pop up window shown below
- Open the main.cpp file and uncomment the
#define TEMP_SENSOR
- Compile and load the image onto the F411 Nucleo
Note
You can refer to Tutorial #2 for compiling and loading the Nucleo board
- Open a terminal window to display the status of your WiFi connection. For this example, set the terminal BAUD rate to 9,600
Note
Refer to Tutorial #3 for setting a terminal emulator.
You should now see the temperature readings on your console output.
Feel free to explore the other sensors. Find the Grove sensor needed, attach it to the Grove sensor shield, and uncomment the corresponding #define.