当前位置:网站首页>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);
}
}
边栏推荐
- Exception handling of arm
- 2.Elment Ui 日期选择器 格式化问题
- Convert IP address to int
- [keil5 debugging] warning:enumerated type mixed with other type
- Not many people can finally bring their interests to college graduation
- [CSDN] C1 training problem analysis_ Part II_ Web Foundation
- I think all friends should know that the basic law of learning is: from easy to difficult
- Matlab reads hexadecimal numbers and converts them into signed short
- Characteristics of PUCCH formats
- Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
猜你喜欢

Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)

How does the memory database give full play to the advantages of memory?
![[graduation successful] [1] - tour [Student Management Information System]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[graduation successful] [1] - tour [Student Management Information System]

There is no specific definition of embedded system

Definition and use of enum in C language

Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
![顺利毕业[3]-博客系统 更新中。。。](/img/91/72cdea3eb3f61315595330d2c9016d.png)
顺利毕业[3]-博客系统 更新中。。。

NR PUCCH format0 sequence generation and detection mechanism

Stm32f407 key interrupt

要選擇那種語言為單片機編寫程序呢
随机推荐
Idea remote breakpoint debugging jar package project
Exception handling of arm
JMX、MBean、MXBean、MBeanServer 入门
UCI and data multiplexing are transmitted on Pusch - Part I
要選擇那種語言為單片機編寫程序呢
Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
STM32 port multiplexing and remapping
Epollet lessons
The third paper of information system project manager in soft examination
There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
SSB Introduction (PbCH and DMRs need to be supplemented)
要选择那种语言为单片机编写程序呢
GPIO port details, Hal library operation keys
Epoll read / write mode in LT and et modes
[22 graduation season] I'm a graduate yo~
UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding
UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
内存数据库究竟是如何发挥内存优势的?
(1) 什么是Lambda表达式
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例