欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 共享適用于stm32f10x單片機的trct5000紅外追跡驅動代碼 [打印本頁]

作者: yukimura_zero    時間: 2023-6-28 23:35
標題: 共享適用于stm32f10x單片機的trct5000紅外追跡驅動代碼
如題,最近用到trct5000紅外追跡模塊,到處找不到代碼,最后,在xxdn上下載下來用了,優化了些代碼
現在共享出來,希望有用的著的朋友們支持一下

單片機源程序如下:
  1. //硬件驅動
  2. #include "usart.h"
  3. #include "common_.h"
  4. #include "TCRT5000.h"

  5. int last_on_status;

  6. void Tcrt_Init(void)
  7. {
  8.         GPIO_InitTypeDef GPIO_InitStructure;

  9.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); // pa
  10.         
  11.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; // pa01->d0
  12. //        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//上拉輸入
  13.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;// 下拉輸入
  14.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  15.         GPIO_Init(GPIOA,&GPIO_InitStructure);
  16.         
  17.         last_on_status = 0;// 默認下拉
  18. }

  19. void Tcrt_test(){
  20.         
  21.         int on_status = 0;
  22.         if(TCRT1 == 0) //循跡到黑線
  23.         {
  24. //                print_str("感應到物體接近...");
  25.                 on_status = 1;
  26.         }else if(TCRT1 == 1) //未循跡到黑線
  27.         {
  28. //                print_str("物體離開...");
  29.                 on_status = 0;
  30.         }
  31.         

  32.         process_trct(on_status, on_status != last_on_status);
  33.         
  34.         last_on_status = on_status;
  35. }
復制代碼







歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1