当前位置:网站首页>STM32 running lantern experiment - library function version
STM32 running lantern experiment - library function version
2022-07-03 09:56:00 【Yiao】
1. To write led.h file
#ifndef __LED_H
#define __LED_H
// If identifier __LED_H Not defined , Then define the identifier __LED_H,
void LED_Init(void);
#endif
3, To write led.c file
#include"led.h"
#include"stm32f4xx.h"
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_SetBits(GPIOF,GPIO_Pin_9 | GPIO_Pin_10);
}
4, Write the main function
#include "stm32f4xx.h"
#include "delay.h"
#include "led.h"
int main()
{
delay_init(168); // Delay function initialization
LED_Init(); //IO Mouth initialization
while(1)
{
GPIO_ResetBits(GPIOF,GPIO_Pin_9);
GPIO_SetBits(GPIOF,GPIO_Pin_10);
delay_ms(500);
GPIO_SetBits(GPIOF,GPIO_Pin_9);
GPIO_ResetBits(GPIOF,GPIO_Pin_10);
delay_ms(500);
}
}
边栏推荐
- How does the nr-prach receiver detect the relationship between prembleid and Ta
- 端午节快乐!—— canvas写的粽子~~~~~
- 在三线城市、在县城,很难毕业就拿到10K
- 要选择那种语言为单片机编写程序呢
- Epollet lessons
- STM32 port multiplexing and remapping
- Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
- SSB Introduction (PbCH and DMRs need to be supplemented)
- byte alignment
- STM32 serial communication principle
猜你喜欢
Windows下MySQL的安装和删除
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
SCM is now overwhelming, a wide variety, so that developers are overwhelmed
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
How does the memory database give full play to the advantages of memory?
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first
03 FastJson 解决循环引用
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
随机推荐
el-table X轴方向(横向)滚动条默认滑到右边
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
PRACH --- originator
03 FastJson 解决循环引用
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
2.Elment Ui 日期选择器 格式化问题
Project cost management__ Cost management technology__ Article 6 prediction
Uniapp realizes global sharing of wechat applet and custom sharing button style
Project scope management__ Scope management plan and scope specification
Nr-prach: access scenario and access process
Basic knowledge of MySQL database (an introduction to systematization)
单片机学到什么程度能找到工作,这个标准不好量化
[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
在三线城市、在县城,很难毕业就拿到10K
[CSDN]C1训练题解析_第二部分_Web基础
Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
Blue Bridge Cup for migrant workers majoring in electronic information engineering
Gpiof6, 7, 8 configuration
[CSDN] C1 training problem analysis_ Part IV_ Advanced web