超声波测距模块
水平有限,下面程序全是例程里的
#include "sys.h"
#include "usart.h"
#include "delay.h"
#include "oled_user.h"
#include "string.h"
#include "ULN.h"
int main(void)
{
Stm32_Clock_Init(9); //系统时钟设置
delay_init(72); //延时初始化
OLED_Init(); //OLED初始化
OLED_Put12x12CNstr(20,0,"超声波测距实验",LIGHT);
OLED_Put12x12CNstr(0,20,"Right: cm",LIGHT);
OLED_Put12x12CNstr(0,40,"Left : cm",LIGHT);
OLED_Refresh_AllGDRAM();
Uln_init(); //超声波初始化
while(1)
{
OLED_Put6x12Num(40,20,Distance1,5