|
stm32超聲波測(cè)距資料
0.png (64.73 KB, 下載次數(shù): 50)
下載附件
2017-4-26 03:28 上傳
源程序:
- #include "led.h"
- #include "delay.h"
- #include "sys.h"
- #include "key.h"
- #include "usart.h"
- #include "exti.h"
- #include "timer.h"
- #include "UltrasonicWave.h"
- int main(void)
- {
- // SystemInit();
- delay_init(72); //延時(shí)初始化
- NVIC_Configuration();
- uart_init(9600); //串口初始化
- LED_Init(); //LED端口初始化
- KEY_Init(); //按鍵端口初始化
- Timerx_Init(5000,7199); //10Khz的計(jì)數(shù)頻率,計(jì)數(shù)到5000為500ms
- UltrasonicWave_Configuration(); //對(duì)超聲波模塊初始化
- while(1)
- {
- UltrasonicWave_StartMeasure(); //開始測(cè)距,發(fā)送一個(gè)>10us的脈沖,然后測(cè)量返回的高電平時(shí)間
- LED0=!LED0;
- delay_ms(1000);
-
-
- }
- }
復(fù)制代碼
完整代碼:
STM32超聲波測(cè)距.zip
(353.84 KB, 下載次數(shù): 101)
2017-4-25 11:15 上傳
點(diǎn)擊文件名下載附件
STM32超聲波測(cè)距 下載積分: 黑幣 -5
|
|