当前位置:网站首页>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);
}
}
边栏推荐
- NR PUCCH format0 sequence generation and detection mechanism
- MYSQL数据库底层基础专栏
- [successful graduation] [1] - visit [student management information system]
- Install local sources using yum
- Windows下MySQL的安装和删除
- Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
- 2020-08-23
- When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
- Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
- Convert IP address to int
猜你喜欢

SCM is now overwhelming, a wide variety, so that developers are overwhelmed

The cyclic shift of PUCCH in NR channel is generated by MATLAB

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

Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit

IDEA远程断点调试jar包项目

CEF download, compile project

UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding

Project cost management__ Cost management technology__ Article 6 prediction

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

STM32 external interrupt experiment
随机推荐
(2)接口中新增的方法
要选择那种语言为单片机编写程序呢
內存數據庫究竟是如何發揮內存優勢的?
STM32 interrupt priority management
自動裝箱與拆箱了解嗎?原理是什麼?
Mysql database underlying foundation column
Successful graduation [2] - student health management system function development...
Which language should I choose to program for single chip microcomputer
Getting started with JMX, MBean, mxbean, mbeanserver
03 FastJson 解决循环引用
学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
Epollet lessons
How does the memory database give full play to the advantages of memory?
MYSQL数据库底层基础专栏
Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
2020-08-23
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding
要選擇那種語言為單片機編寫程序呢
[CSDN] C1 training problem analysis_ Part II_ Web Foundation