当前位置:网站首页>Bearpi IOT lighting LED
Bearpi IOT lighting LED
2022-06-12 04:27:00 【Learn the Mediterranean】
STM32CubeMX Lighten up LED The lamp
1、 Schematic diagram
Chip type : STM32L431RC
LED Pin : PC13
Output mode : Push pull output , Output high level is on LED The lamp 

2、STM32CubeMX To configure LED
Be careful : The project save path cannot contain Chinese characters , otherwise KEIL5 The boot file will not be found , The following error occurred 
1、 Create a new project

2、 Select chip , Double click in 
3、 Configure pins 
After selecting the pin , Set user alias , Easy to program 
4、 Configure clock tree 
5、 Build project
Here, I accidentally saved the file in the Chinese path , Has been changed ! Do not commit !!!

2、 Write code
Be careful : The user code needs to be written in
/* USER CODE BEGIN */
/* USER CODE END * / Between , Otherwise, if you reuse CubeMX Generate the file code , User codes outside these areas will be deleted
1、 The correlation function is in stm32l4xx_hal_gpio.h Statement in , You can use the following function to achieve LED Pin output of
void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
For example, the following writing , Can achieve 1sLED State flip :
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);// destroy
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);// bright
HAL_Delay(1000);
perhaps
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);// Flip
HAL_Delay(1000);
3、 Burn files
1、 install STLINK drive
2、 Set the burning mode 
3、 Compile and download 
边栏推荐
- Enterprise Architect v16
- Dynamic gauge (15) - Minimum toll
- 【C语言】封装接口(加减乘除)
- Why should a redis cluster use a reverse proxy? Just read this one
- R language plot visualization: use plot to visualize simple regression model linear regression plots
- mysqld: Can‘t create directory ‘D: oftinstall\mysql57 (Errcode: 2 - No such file or directory)
- 疫情数据分析平台工作报告【7】阿里云相关
- R语言plotly可视化:plotly可视化基础二维直方图、自定义设置二维直方图的颜色、二维直方图是二元分布的直方图可视化(Basic 2D Histogram)
- Street lighting IOT technology scheme, esp32-s3 chip communication application, intelligent WiFi remote control
- PHP and JS remove all spaces
猜你喜欢

MySQL master-slave construction and Django implementation of read-write separation
![[C language] analysis of variable essence](/img/b4/13a5800f2c960ec590c9f7480b09d0.png)
[C language] analysis of variable essence

How to have peace of mind? Get a new heart
![[official testerhome] MTSC 2021 Shanghai and Shenzhen PPT download addresses](/img/a0/d1170b20d01a7a586d8ff68279f1d4.jpg)
[official testerhome] MTSC 2021 Shanghai and Shenzhen PPT download addresses

Why should a redis cluster use a reverse proxy? Just read this one

Create a new table in the database. There was no problem before. Today
![[C language] encapsulation interface (addition, subtraction, multiplication and division)](/img/8f/1351826a6f7e83ce90d32d7615adc1.png)
[C language] encapsulation interface (addition, subtraction, multiplication and division)

【FPGA混沌】基于FPGA的混沌系统verilog实现
![[wechat applet] the mobile terminal selects and publishes pictures](/img/9a/46bc4a7bf9b70d26b0e24fe02f747d.jpg)
[wechat applet] the mobile terminal selects and publishes pictures

【高效】最强开发工具Ctool编译踩坑
随机推荐
Will subsequent versions support code block search highlighting
AI and logistics Patent
Question for the 3D printing lattice?
Kotlin 启动协程、launch 与async的区别、按照顺序启动协程
Kinematic gauge (14) - Triangle optimal path problem
QT compiling security video monitoring system 43- picture playback
[SC] OpenService FAILED 5: Access is denied.
【FPGA+GPS接收器】基于FPGA的双频GPS接收器详细设计介绍
How do I extract files from the software?
JSP实现银柜台业务绩效考核系统
Smart Panel wifi Linkage Technology, esp32 wireless chip module, Internet of Things WiFi Communication Application
leetcode797. All possible paths (medium)
Implementation of fitness club management system based on SSH
Work report of epidemic data analysis platform [6.5] epidemic map
windows如何安装多个版本mysql,如何同时启动
Oracle's instr()
[issue 31] 360 background development practice experience - two rounds of technical aspects
Kill session? This cross domain authentication solution is really elegant!
MySQL master-slave construction and Django implementation of read-write separation
Detailed explanation of Command Execution Vulnerability