Introduction: The Easiest Way to Program a Microcontroller!
Are you interesting in having a microcontroller that uses a lot less power? Today, I’ll introduce you to the STM32 Ultra Low Power - L476RG, which uses 4 times less energy than an Arduino Mega and has a powerful Cortex processor. I will also talk about MBED, which is a C language that works not only on STMicroelectronics processors, but also on NXP and a series of processors that have an ARM nucleus. Lastly, I'll show you an online compiler.
Step 1: STM NUCLEO-L476RG
• STM32L476RGT6 in LQFP64 package
• ARM®32-bit Cortex®-M4 CPU
• Adaptive real-time accelerator
• (ART Accelerator ™) allowing 0-wait state execution
• from Flash memory
• 80 MHz max CPU frequency
• VDD from 1.71 V to 3.6 V
• 1 MB Flash
• 128 KB SRAM
• SPI (3)
• I2C (3)
• USART (3)
• UART (2)
• LPUART (1)
• GPIO (51) with external interrupt capability
• Capacitive sensing with 12 channels
• 12-bit ADC (3) with 16 channels
• 12-bit DAC with 2 channels
Step 2: Create an Account
Go to www.mbed.com and create an account. Fill in the registration data.
Click on the captcha, read and accept the terms, and click "Sign up".
Step 3: Log Into It
After registering, check your email and log in to the MBED website
Step 4: Add Board to Compiler
If you already have an MBED card plugged into your computer, it will appear as a thumb drive. Inside it, open the MBED.HTM file in the browser.
Or you can go to os.mbed.com/platforms and choose your board from the list of boards.
On the page of your board, click on "Add to your MBED Compiler"
Step 5: Sample Code
Go to this page with the blink example and click on "Import into Compiler.”
Step 6: Import Example
On the screen that opens, click "Import"
Step 7: To Compile
Click the "Compile" button so that the server compiles the source code into a binary file.
The browser will begin downloading the binary file as soon as the server finishes compiling.
Step 8: Transfer Binary to the Board
To transfer the binary to the card, simply drag or copy and paste the downloaded binary file into the card folder, which will appear as a thumb drive.
Step 9: Blink
Here we have the code. We will include the MBED, set the output digital pin, among other commands.
#include "mbed.h"
DigitalOut myled(LED1); int main() { while(1) { myled = 1; // LED is ON wait(0.2); // 200 ms myled = 0; // LED is OFF wait(1.0); // 1 sec } }