如何做h5商城网站,免费注册个人网站不花钱,陕西外贸英文网站建设,企业网站模板2016成套基于Mbed Studio环境下开发STM32 #x1f4cd;Mbed官网#xff1a;https://os.mbed.com/ ✨mbed OS是ARM出的一个免费开源的#xff0c;面向物联网的操作系统。提供了一个定义良好的API来开发C应用程序#xff1b;集成度很高#xff0c;类似Arduino#xff0c;目前并不兼… 基于Mbed Studio环境下开发STM32 Mbed官网https://os.mbed.com/ ✨mbed OS是ARM出的一个免费开源的面向物联网的操作系统。提供了一个定义良好的API来开发C应用程序集成度很高类似Arduino目前并不兼容所有STM32型号大容量的基本都支持中小容量的没有全部覆盖也不推荐在此系统上使用。目前提供了三种开发模式Keil Studio Cloud、Mbed Studio、Mbed CLI。 使用必须要注册账号。如果使用Mbed Studio IDE开发推荐使用云编译器占用本地磁盘空间比较小。转为本地的话整个工程系统需要占用1.5GB左右的磁盘空间。使用Keil Studio Cloud网页版,在线编译速度最快。
串口输出点灯示例
编译器版本mbed-os 6.13.0
#include mbed.h
// Blinking rate in milliseconds
#define BLINKING_RATE 500msBufferedSerial pc(PA_2, PA_3); // usart2 PA2-TX2 PA3-RX2
FileHandle *mbed::mbed_override_console(int fd) { return pc; }int main()
{pc.set_blocking(false); // 设置为非阻塞模式pc.set_baud(115200); // 设置波特率为115200// Initialise the digital pin LED1 as an outputDigitalOut led(PC_13);//设置引脚输出模式DigitalOut led2(PA_5);while (true) {led !led;led2 !led2;printf(Web2 STM32F446 SysClockFreq:%d \r\n, HAL_RCC_GetSysClockFreq());ThisThread::sleep_for(BLINKING_RATE);//延时}
}按键输入测试代码
编译器版本mbed-os 6.13.0
/* mbed Microcontroller Library* Copyright (c) 2019 ARM Limited* SPDX-License-Identifier: Apache-2.0*/#include mbed.h// Blinking rate in milliseconds
#define BLINKING_RATE 500ms
BufferedSerial pc(PA_2, PA_3); // usart2 PA2-TX2 PA3-RX2FileHandle *mbed::mbed_override_console(int fd) { return pc; }int main()
{pc.set_blocking(false); // 设置为非阻塞模式pc.set_baud(115200); // 设置波特率为115200// Initialise the digital pin LED1 as an outputDigitalOut led(PC_13);//配置为输出DigitalOut led2(PA_5);DigitalIn KEY(PD_2,PullUp);//配置PD2为输入上拉while (true) {led !led;led2 !led2;printf(Web2 STM32F446 SysClockFreq:%d \r\n, HAL_RCC_GetSysClockFreq());ThisThread::sleep_for(BLINKING_RATE);if(0KEY.read()){printf(Key Press!\n);}}
}