e6729d723f502d494b67d374f5fa2b7.jpg (127.31 KB, 下載次數(shù): 81)
下載附件
2021-10-26 10:55 上傳
單片機源程序如下:
- #include <stm32f10x.h>
- #include <stdio.h>
- #include "usart.h"
- #include "string.h"
- #include "led.h"
- #include "sys.h"
- #include "oled.h"
- #include "delay.h"
- #include "bmp.h"
- #include "dht11.h"
- char usart1_buf[BUF_SIZE]; // 串口1接收數(shù)據(jù)數(shù)組
- char usart1_index; // 串口1接收數(shù)據(jù)下標(長度)
- char usart1_flag; // 串口1接收完畢標志(是:1 否:0)
- int main (void)
- {
- // 初始化硬件函數(shù)調(diào)用
- u8 temp;
- u8 humi;
-
- Init_USART1(); // 串口初始化,9600
- Init_LED();
- Delay_init();
- OLED_Init();
-
- while(1)
- {
-
-
- OLED_Refresh();
-
- DHT11_Read_Data(&temp,&humi);//
-
- OLED_ShowChinese(0,0,0,16,1);//
- OLED_ShowChinese(18,0,1,16,1);//
- OLED_ShowChar(36,0,':',16,1);//顯示ASCII字符
- /*OLED_ShowChinese(54,0,2,16,1);//
- OLED_ShowChinese(72,0,3,16,1);//
- OLED_ShowChinese(90,0,4,16,1);//
- */
-
- OLED_ShowChinese(0,16,5,16,1);//
- OLED_ShowChinese(18,16,6,16,1);//
- OLED_ShowChar(32,16,':',16,1);//顯示ASCII字符
- OLED_ShowNum(50,16,temp,2,16,1);
- OLED_ShowChinese(68,16,9,16,1);//
-
-
- OLED_ShowChinese(0,32,7,16,1);//
- OLED_ShowChinese(18,32,8,16,1);//
- OLED_ShowChar(32,32,':',16,1);//顯示ASCII字符
- OLED_ShowNum(48,32,humi,2,16,1);
- OLED_ShowChar(66,32,'%',16,1);//顯示ASCII字符
- }
-
- }
復制代碼
代碼下載:
代碼.7z
(340.67 KB, 下載次數(shù): 404)
2021-10-26 20:35 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|