|
stm32驅(qū)動(dòng)mq2和bmp280和ds18b20和oled的瓦斯報(bào)警系統(tǒng)
單片機(jī)源程序如下:
- #include "bsp.h"
- #include "stdio.h"
- #include "stm32f10x.h"
- #include "systick.h"
- #include "LED.h"
- #include "USART.h"
- #include "DS18B20.h"
- #include "oled.h"
- #include "sys.h"
- #include "adc.h"
- #include "beep.h"
- #include "myiic.h"
- #include "bme280.h"
- float Temp;
- float bmp280_temp;
- float bmp280_press;
- float bmp280_humi;
- float high;
- int main(){
- OLED_Init();
- BEEP_Init();
- Adc_Init();
- delay_init();
- USART1_Init();
- LED_Init();
- delay_ms(1000);
- while(!Ds18b20_Init());
- while(1){
- // bme280GetData(&bmp280_press,&bmp280_temp,&bmp280_humi,&high);
- LED_Turn();
- Temp=Ds18b20ReadTemp();
- // printf("temp:%2.4f\r\n",Temp*0.0625);
- OLED_Num5(0,1,Get_Adc_Average(ADC_Channel_1,10));
- OLED_Num5(0,0,Temp*0.0625);
- delay_ms(1000);
- }
-
- }
復(fù)制代碼
所有代碼51hei下載,如有錯(cuò)誤請(qǐng)大家多多指教:
UART+DS18B20.7z
(211.7 KB, 下載次數(shù): 108)
2021-6-15 20:11 上傳
點(diǎn)擊文件名下載附件
|
評(píng)分
-
查看全部評(píng)分
|