?? main.c
字號:
#include<stm32f10x_lib.h>
#include<string.h>
#include<stdio.h>
#include"ds18b20.h"
#include"STM32_Init.h"
#include"TFT200.h"
#define led1 (1<<6) //led1用來指示是否超過指定溫度
#define alarm 30 //警戒溫度30
int value=0;
char s[];
int main(void)
{
stm32_Init();
LCD_Init();
LCD_Clear_Screen(Blue);
LCD_PutString(50,30,"DS18B20測溫實驗",Red,Yellow);
for(;;)
{
value=readtemperature();
if(value>=30)
GPIOB->ODR|=led1; //如果溫度超過30度,則led1亮
else
GPIOB->ODR&=~led1; //低于30度,則滅led1
sprintf(s,"溫度:%d",value);
LCD_PutString(70,70,s,Red,Yellow);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -