int main(void)
{
float length;
delay_init(); //延时函数初始化
NVIC_Configuration(); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
uart_init(9600); //串口初始化为9600
Hcsr04Init();
printf("串口测试\n");
Hcsr04Init();
printf("超声波初始化成功!\n");
while(1)
{
length = Hcsr04GetLength();
printf("Length = %.3f cm\n",length);
delay_ms(50);
}
}