[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>1.工具
* USB-TTL(非常便宜,几块钱)
* STM32F103C8T6(几块钱)
<>2.引脚连线
USB-TTLSTM32
TXPA10
RXPA9
VCC3.3V
GNDGND
注意事项:
* 跳线帽位置:BOOT0接高电平(1),BOOT1接低电平(0)
* 每次上传程序前需要按一下复位键(之后,跳线帽的位置不需要改变,程序即可正常运行),否则会可能出现下面这种情况:
<>3.开发环境搭建
* 在Vscode中下载platformio插件:
2. 新建工程
3.注意事项:第一次新建工程时,速度会特别慢,因此可以直接添加我已经下载好的资源包,放到自己的电脑相应位置中即可,这样第一次新建工程时速度就会非常快,不过第一次上传程序时仍然会自动下载一些依赖(比如下载工具,这个不用管会自动进行下载,速度很快)
<>4.工程配置
在platformio.ini文件中需要添加以下代码(注意根据自己的串口进行修改)
[env:genericSTM32F103C8] platform = ststm32 board = genericSTM32F103C8
framework= arduino upload_port = COM17 monitor_port = COM17 upload_protocol =
serial
<>5.测试程序
注意事项:
* 由于stm32的调试串口是非Arduino标准定义的,因此需要使用SoftwareSerial库。
* 串口调试:经过测试,串口波特率只能设置为9600,设置其他数值无法进行串口打印调试 // 示例1:点灯测试程序 #include <Arduino.h>
#define ledPin PC13 void setup() { pinMode(ledPin, OUTPUT); } void loop() {
digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); delay(500); }
// // 示例程序2:串口调试 // #include <Arduino.h> // #include <SoftwareSerial.h> //
const byte txPin = PA9; // const byte rxPin = PA10; // SoftwareSerial
mySerial(rxPin, txPin); // static int i = 0; // void setup() // { //
pinMode(rxPin, INPUT); // pinMode(txPin, OUTPUT); // mySerial.begin(9600); // }
// void loop(){ // mySerial.println(i++); // delay(500); // }