on
2021-03-22
06:57 AM
- edited on
2024-09-04
07:51 AM
by
Laurids_PETERSE
This FAQ concerns the STM32duino, after following this tutorial, it will be possible to get to know how to use STM32 Nucleo boards within the Arduino IDE and generate codes to run on them. In this article we use a STM32 Nucleo board and an ST MEMS shield.
This part is about running a simple example on STM32duino which is blinking a LED.
Follow the Arduino Software installation link and finish it by executing the exe file.
Select: “Tools -> Board-> Boards Manager” and install STM32 Cores.
After finishing this step, the STM32 package will be installed, and the different ST compatible boards will be added to the tool.
From: “Tools -> Board part number”, choose Nucleo-L476RG.
From “File -> example -> 01. Basics”, choose Blink.
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(2000); // wait for 2 seconds digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second
The main target of this part is including ST MEMS shields within the STM32 Nucleo Boards and programming it through Arduino IDE with the goal of displaying the data got from the sensors.
The hardware used is Nucleo-F030R8 and X-NUCLEO-IKS01A2.
Note: The sensors present on the IKS01A2 are:
|
X-NUCLEO-IKS01A2
LSM6DSL
LSM303AGR
HTS221
LPS22HB
To start and run a project, it is mandatory to select the board working with, so select the Nucleo boards through “Tools -> Board -> STM32 Boards -> Nucleo-64”.
Warning:
Please make sure to choose the right port connected to the board.
From “File -> Examples -> STM32duino LSM303AGR” and generate the example on the Arduino IDE:
X-NUCLEO_IKS01A2_LSM303AGR_DataLog_Terminal
To display the values got from the sensors, open the Arduino Terminal from “Tools -> Serial Port” and select the frequency to 9600 as presented in the code:
// Initialize serial for output. SerialPort.begin(9600);
At this point, the data can be displayed on the serial monitor as follows:
Disclaimer: STMicroelectronics does not provide support to these libraries.
For any support on these libraries, refer to the STM32duino forum and STM32duino GitHub.