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

標題: STM32超聲波壁障小車程序 未完善 [打印本頁]

作者: TianWei1111    時間: 2019-1-23 18:23
標題: STM32超聲波壁障小車程序 未完善
大家自己看看

單片機源程序如下:
  1. #include "led.h"
  2. #include "sys.h"
  3. #include "LCD1602.h"
  4. #include "delay.h"
  5. #include "sys.h"
  6. #include "key.h"
  7. #include "usart.h"
  8. #include "exti.h"
  9. #include "timer.h"
  10. #include "UltrasonicWave.h"
  11. #include "stm32f10x.h"
  12. #include "turn.h"
  13. extern float UltrasonicWave_Distance;
  14. /*
  15. 1602 rs rw en B3 B4 B5
  16.                           DB0-DB7 B8-B15
  17. TRIG_PIN       A8      
  18. ECHO_PIN       A7         

  19. */
  20. int main(void)
  21. {
  22. //        char DIS[2]={'c','m'};
  23. //        char juli[9]={'d','i','s','t','a','n','c','e'};
  24. //        //char DISTANCE[1]={'c','m'};
  25. // // SystemInit();
  26. turn_Init();
  27.         delay_init(72);                  //延時初始化
  28.         NVIC_Configuration();
  29.         //uart_init(9600);         //串口初始化
  30. LED_Init();                            //LED端口初始化
  31. //        KEY_Init();               //按鍵端口初始化
  32.         Timerx_Init(5000,14399);   //10Khz的計數頻率,計數到5000為500ms
  33.         UltrasonicWave_Configuration();               //對超聲波模塊初始化
  34.         // LCD1602_InitPort();
  35.         // lcd1602_init();
  36.         //lcd1602_pos(0x80,0x81);
  37.         //strdis((u8 *)juli);
  38.         //lcd1602_pos(0xcB,0xcC);
  39.         //strdis((u8 *)DIS);
  40. // turn_zhi();
  41.         while(1)
  42.         {
  43.                 //LED0=!LED0;
  44. //                turn_zhi();
  45. //                 turn_zuo();
  46. //   
  47.         UltrasonicWave_StartMeasure();                //開始測距,發送一個>10us的脈沖,然后測量返回的高電平時間       
  48. UltrasonicWave_Distance=TIM_GetCounter(TIM2)*5*34/200.0;
  49. ////  turn_zhi();
  50.                 delay_ms(1000);       
  51. if(UltrasonicWave_Distance>10)
  52.                 {
  53.                          turn_zhi();
  54. }
  55.                 if(UltrasonicWave_Distance<10)
  56.                 {
  57.                         turn_stop();
  58.                 }
  59.                
  60.                
  61.         }
  62. }
復制代碼

所有資料51hei提供下載:
STM32超聲波壁障小車未完善.7z (204.1 KB, 下載次數: 7)







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