找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 4613|回復(fù): 1
收起左側(cè)

stm32超聲波測(cè)距源程序資料

[復(fù)制鏈接]
ID:193332 發(fā)表于 2017-4-25 11:17 | 顯示全部樓層 |閱讀模式
stm32超聲波測(cè)距資料
0.png

源程序:
  1. #include "led.h"
  2. #include "delay.h"
  3. #include "sys.h"
  4. #include "key.h"
  5. #include "usart.h"
  6. #include "exti.h"
  7. #include "timer.h"
  8. #include "UltrasonicWave.h"


  9. int main(void)
  10. {
  11. // SystemInit();
  12.         delay_init(72);                  //延時(shí)初始化
  13.         NVIC_Configuration();
  14.         uart_init(9600);         //串口初始化
  15.         LED_Init();                            //LED端口初始化
  16.         KEY_Init();               //按鍵端口初始化
  17.         Timerx_Init(5000,7199);   //10Khz的計(jì)數(shù)頻率,計(jì)數(shù)到5000為500ms
  18.         UltrasonicWave_Configuration();               //對(duì)超聲波模塊初始化

  19.         while(1)
  20.         {
  21.                 UltrasonicWave_StartMeasure();                //開(kāi)始測(cè)距,發(fā)送一個(gè)>10us的脈沖,然后測(cè)量返回的高電平時(shí)間

  22.                 LED0=!LED0;
  23.                 delay_ms(1000);       
  24.        
  25.                
  26.         }
  27. }

復(fù)制代碼

完整代碼:
STM32超聲波測(cè)距.zip (353.84 KB, 下載次數(shù): 101)

回復(fù)

使用道具 舉報(bào)

ID:511461 發(fā)表于 2019-4-18 19:00 | 顯示全部樓層
迷你版的嗎
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表