亚洲春色中文字幕久久久-三上亚,91精品国产亚一区二区三区,久久久九色综合亚洲成色777,涩涩视频下载,国产午夜亚洲精品午夜鲁丝片,国产精品A一区二区三区腾讯导航,影音先锋色情AV在线看片,蜜臀国产在线视频,极品少妇高潮啪啪无码吴梦梦 ,精品人妻无码一区二区三区手机版
標題:
stm32超聲波避障源碼
[打印本頁]
作者:
sdlqwql
時間:
2017-12-30 20:21
標題:
stm32超聲波避障源碼
stm32超聲波避障
舵機信號口:A0
超聲波信號口:TRIG===B8
ECHO==B9
小車電機驅動口依次:左電機:C8 C9 右電機:C6 C7
小車電機驅動EA使能端口:A6,A7
單片機源程序如下:
/**
******************************************************************************
* @file main.c
* @author MCD Application Team
* @version V3.5.0
* @date 08-April-2011
* @brief Main program body
**/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "usart1.h"
#include "SysTick.h"
#include "motor_control.h"
#include "UltrasonicWave.h"
#include "TIM3.h"
#include "pwm_output.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
vu32 Onward_flag=0;
vu8 RxBuffer[2];
vu32 PWM_flag=0;
vu32 Left_flag=0;
vu32 Right_flag=0;
vu32 Backward_flag=0;
vu32 Stop_flag=0;
vu32 Xunji_flag=0;
vu32 Auto_flag=0;
vu8 count=0;
/* Private function prototypes -----------------------------------------------*/
void NVIC_Configuration(void);
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* 函數名 : main
* 描述 : 主函數
* 輸入 : 無
* 輸出 : 無
* 返回 : 無
*******************************************************************************/
int main(void)
{
/* NVIC configuration */
NVIC_Configuration();
/* Configure the Usart1 */
USART1_Config();
/* Configure the DMA1 */
DMA_Configuration();
/* Configure the GPIO */
GPIO_Configuration();
/* Configure the TIM2 */
TIM2_Configuration();
/* Configure the TIM3 */
TIM4_Configuration();
/* Configure the TIM4 */
Control_GPIOE_Config(); /*配置傳感器輸入信號管腳*/
// TIM4_Configuration();
TIM3_GPIO_Config();
/* Configure the systick */
SysTick_Init();
/* Configure the UltrasonicWave */
UltrasonicWave_Configuration();
Degree(85,1);
// Delay_ms(1500);
while (1)
{
Auto_run();
// if(Onward_flag==1)
// {
// Forward_run(); //前進
// }
// else if(Backward_flag==1)
// {
// Backward_run(); //后退
// }
// else if(Left_flag==1)
// {
// Left_turn(); //左轉
// }
// else if(Right_flag==1)
// {
// Right_turn(); // 右轉
// }
// else if(Auto_flag==1)
// {
// Auto_run(); //自動避障行駛
// }
// else if(Xunji_flag==1)
// {
// Xunji_run(); //自動循跡行駛
// }
// else
// {
// Stop(); //暫停
// }
}
}
/*******************************************************************************
* 函數名 : NVIC_Configuration
* 描述 : 初始化NVIC
* 輸入 : 無
* 輸出 : 無
* 返回 : 無
*******************************************************************************/
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure the Priority Group to 2 bits */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
stm32-超聲波避障.rar
(306.3 KB, 下載次數: 106)
2017-12-31 00:55 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
hello_bug
時間:
2018-1-3 13:47
避障,再加上點循跡,來個攝像頭,完美。
作者:
可可分享
時間:
2018-2-1 22:23
謝謝分享 用上了
歡迎光臨 (http://www.denmoz.com/bbs/)
Powered by Discuz! X3.1