STM32F103VET6基于Arduino开发框架下串口和软串口通讯示例
Posted perseverance52
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了STM32F103VET6基于Arduino开发框架下串口和软串口通讯示例相关的知识,希望对你有一定的参考价值。
STM32F103VET6基于Arduino开发框架下串口和软串口通讯示例
-
📌相关篇《【硬件开源电路】STM32F103VCT6开发板》
-
🌺通讯演示:
✨本示例来源于STM32核心固件自带例程。
- 📢对于
STM32F103VET6
芯片,Arduino开发环境下,默认串口是:PA10,PA9,对于不同系列的STM32默认串口引脚不一定是这个两个引脚上,这一点需要注意。
📝示例代码
/*
Software serial multiple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)
created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example
This example code is in the public domain.
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(PC11, PC10); // RX, TX
void setup()
// Open serial communications and wait for port to open:
Serial.begin(115200, SERIAL_8N1);//PA10,PA9
while (!Serial)
; // wait for serial port to connect. Needed for native USB port only
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("Hello, world?");
void loop() // run over and over
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
以上是关于STM32F103VET6基于Arduino开发框架下串口和软串口通讯示例的主要内容,如果未能解决你的问题,请参考以下文章
STM32F103VET6基于Arduino开发框架下串口和软串口输出乱码解决方案
STM32F103VET6基于STM32CubeMX RTC时钟报警中断使用示例
STM32F103C8T6基于Arduino框架下利用定时器跑RBG灯闪烁
STM32F103VET6基于STM32CubeMX利用EXTI外部中断测量PWM频率