欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
共享適用于stm32f10x單片機(jī)的trct5000紅外追跡驅(qū)動(dòng)代碼
[打印本頁(yè)]
作者:
yukimura_zero
時(shí)間:
2023-6-28 23:35
標(biāo)題:
共享適用于stm32f10x單片機(jī)的trct5000紅外追跡驅(qū)動(dòng)代碼
如題,最近用到trct5000紅外追跡模塊,到處找不到代碼,最后,在xxdn上下載下來(lái)用了,優(yōu)化了些代碼
現(xiàn)在共享出來(lái),希望有用的著的朋友們支持一下
單片機(jī)源程序如下:
//硬件驅(qū)動(dòng)
#include "usart.h"
#include "common_.h"
#include "TCRT5000.h"
int last_on_status;
void Tcrt_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); // pa
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; // pa01->d0
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//上拉輸入
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;// 下拉輸入
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_InitStructure);
last_on_status = 0;// 默認(rèn)下拉
}
void Tcrt_test(){
int on_status = 0;
if(TCRT1 == 0) //循跡到黑線
{
// print_str("感應(yīng)到物體接近...");
on_status = 1;
}else if(TCRT1 == 1) //未循跡到黑線
{
// print_str("物體離開(kāi)...");
on_status = 0;
}
process_trct(on_status, on_status != last_on_status);
last_on_status = on_status;
}
復(fù)制代碼
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1