题目内容
#include "stm32f10x_heads.h"#include "HelloRobot.h"void Timx_Init(void);#define LeftIR GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2) //左边红外接收连接到PE2unsigned int time;//定时时间值int leftdistance;//左边的距离int distanceLeft, irDetectLeft;unsigned int frequency[5]={29370,31230,33050,35700,38460};void Timx_Init(void){(1)//复位TIM2定时器}void FreqOut(unsigned int Freq){//设置定时器T2(2)/* Clear TIM2 update pending flag[清除TIM2溢出中断标志] */(3)/* Enable TIM2 Update interrupt [TIM2溢出中断允许]*/(4)/* TIM2 enable counter [允许tim2计数]*/(5)delay_nus(800);//延时(6)//停止定时器}void Get_lr_Distances(){unsigned int count;leftdistance = 0;//初始化左边的距离for(count = 0;count<5;count++){(7)//发射频率irDetectLeft = (8);printf("irDetectLeft = %d\r\n",irDetectLeft);(9)}}int main(void){BSP_Init();Timx_Init();//定时器初始化函数USART_Configuration();printf("Program Running!\r\n");printf("FREQENCY DETECTED\r\n");while(1){(10)printf("distanceLeft = %d\r\n",(11));printf("-----------------\r\n");delay_nms(1000);}}
查看答案
搜索结果不匹配?点我反馈