当前位置:网站首页>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);
#endif3, 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);
}
}
边栏推荐
- JMX、MBean、MXBean、MBeanServer 入门
- [CSDN] C1 training problem analysis_ Part IV_ Advanced web
- 应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
- The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
- Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
- MySQL的简单使用(增删改查)
- Electronic product design, MCU development, circuit cloning
- 学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
- 当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
- SCM is now overwhelming, a wide variety, so that developers are overwhelmed
猜你喜欢
![Successful graduation [2] - student health management system function development...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [2] - student health management system function development...

Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()

In third tier cities and counties, it is difficult to get 10K after graduation

万字手撕七大排序(代码+动图演示)

The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving

【男保姆式】教你打开第一个微信小程序

要选择那种语言为单片机编写程序呢

Fundamentals of Electronic Technology (III)__ Fundamentals of circuit analysis__ Basic amplifier operating principle

Oracle数据库 SQL语句执行计划、语句跟踪与优化实例

Mysql database underlying foundation column
随机推荐
Idea remote breakpoint debugging jar package project
Nr-prach:prach format and time-frequency domain
万字手撕七大排序(代码+动图演示)
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
Intelligent home design and development
STM32 general timer output PWM control steering gear
Notes on C language learning of migrant workers majoring in electronic information engineering
It is difficult to quantify the extent to which a single-chip computer can find a job
Project scope management__ Scope management plan and scope specification
【順利畢業】[1]-遊覽 [學生管理信息系統]
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
SSB Introduction (PbCH and DMRs need to be supplemented)
Install local sources using yum
Getting started with shell programming
CEF download, compile project
STM32 external interrupt experiment
Windows下MySQL的安装和删除
Epollet lessons
没有多少人能够最终把自己的兴趣带到大学毕业上