• 大小: 6.16MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-23
  • 语言: 其他
  • 标签: stm32f103  循迹避障  

资源简介

这个程序是基于STM32F103的循迹避障小车,需要的硬件有小车模型、电机驱动模块,直流电机、stm32F103芯片、还有两个红外传感器和一个红外对管

资源截图

代码片段和文件信息

#include“exti.h“
#include“led.h“
#include“SysTick.h“
#include“pwm.h“

/*******************************************************************************
* 函 数 名         : My_EXTI_Init
* 函数功能    : 外部中断初始化
* 输    入         : 无
* 输    出         : 无
*******************************************************************************/
void My_EXTI_Init(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIOENABLE);

GPIO_EXTILineConfig(GPIO_PortSourceGPIOA GPIO_PinSource0);//选择GPIO管脚用作外部中断线路


//EXTI0 NVIC 配置
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;//EXTI0中断通道
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=2;//抢占优先级
NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器

EXTI_InitStructure.EXTI_Line=EXTI_Line0;
EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger=EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd=ENABLE;
EXTI_Init(&EXTI_InitStructure);

}

/*******************************************************************************
* 函 数 名         : EXTI0_IRQHandler
* 函数功能    : 外部中断0函数
* 输    入         : 无
* 输    出         : 无
*******************************************************************************/
void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line0)==0)
{
pwm(300665665300); delay_s(1); //前进
while(1);
//  pwm(665300665300); delay_ms(125); //左转
//  pwm(300665665300); delay_s(1); //前进
//  pwm(300665300665); delay_ms(125); //右转
//  pwm(300665665300); delay_s(1); //前进
//  pwm(300665300665); delay_ms(125); //右转
//  pwm(300665665300); delay_s(1); //前进
//  pwm(665300665300); delay_ms(125); //左转
}
EXTI_ClearITPendingBit(EXTI_Line0);
}





 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-07-15 21:15  智能小车\
     目录           0  2020-07-15 21:15  智能小车\APP\
     目录           0  2020-07-15 21:15  智能小车\APP\exti\
     文件        2020  2020-07-09 11:20  智能小车\APP\exti\exti.c
     文件          97  2016-08-26 10:59  智能小车\APP\exti\exti.h
     目录           0  2020-07-15 21:15  智能小车\APP\exti2\
     文件        4027  2020-07-09 10:53  智能小车\APP\exti2\exti2.c
     文件         155  2020-07-09 10:53  智能小车\APP\exti2\exti2.h
     目录           0  2020-07-15 21:15  智能小车\APP\led\
     文件        2797  2020-07-09 15:00  智能小车\APP\led\led.c
     文件         718  2020-07-09 11:30  智能小车\APP\led\led.h
     目录           0  2020-07-15 21:15  智能小车\APP\pwm\
     文件        3921  2020-07-08 17:26  智能小车\APP\pwm\pwm.c
     文件         490  2020-07-08 17:26  智能小车\APP\pwm\pwm.h
     目录           0  2020-07-15 21:15  智能小车\Libraries\
     目录           0  2020-07-15 21:15  智能小车\Libraries\CMSIS\
     文件       17273  2010-06-07 10:25  智能小车\Libraries\CMSIS\core_cm3.c
     文件       85714  2011-02-09 14:59  智能小车\Libraries\CMSIS\core_cm3.h
     文件       15503  2011-03-10 10:52  智能小车\Libraries\CMSIS\startup_stm32f10x_md.s
     文件       36557  2011-03-10 10:51  智能小车\Libraries\CMSIS\system_stm32f10x.c
     文件        2085  2011-03-10 10:51  智能小车\Libraries\CMSIS\system_stm32f10x.h
     目录           0  2020-07-15 21:15  智能小车\Libraries\STM32F10x_StdPeriph_Driver\
     目录           0  2020-07-15 21:15  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\
     文件        8982  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\misc.h
     文件       21690  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_adc.h
     文件        7555  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_bkp.h
     文件       27559  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_can.h
     文件        6573  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_cec.h
     文件        2162  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_crc.h
     文件       15233  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dac.h
     文件        3818  2011-03-10 10:47  智能小车\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dbgmcu.h
............此处省略174个文件信息

评论

共有 条评论