STM32F407ZG连接MODBUS模块实现流水灯。
mian.c 文件
#include "stm32f4xx.h"
void Delay(__IO uint32_t nCount);
void Delay(__IO uint32_t nCount)
{
while(nCount--){}
}
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 ;
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);
while(1){
GPIO_SetBits(GPIOF,GPIO_Pin_12);
Delay(0x7FFFFF);
GPIO_ResetBits(GPIOF,GPIO_Pin_12);
Delay(0x7FFFFF);
GPIO_SetBits(GPIOF,GPIO_Pin_13);
Delay(0x7FFFFF);
GPIO_ResetBits(GPIOF,GPIO_Pin_13);
Delay(0x7FFFFF);
GPIO_SetBits(GPIOF,GPIO_Pin_14);
Delay(0x7FFFFF);
GPIO_ResetBits(GPIOF,GPIO_Pin_14);
Delay(0x7FFFFF);
}
}
单片机连接modbus实现流水灯的视频(
https://live.csdn.net/v/214622?spm=1001.2014.3001.5501)。
这个是流水灯项目的整个keil文件打包,下载使用keil5打开就可以使用了(
https://download.csdn.net/download/qq_50808730/85573771)。



