diff --git a/ReadMe.md b/ReadMe.md index 90138ea..b2e2321 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -38,8 +38,14 @@ uart_temp是用于8051单片机上的一个项目,用于获取温度,并使 4. 打开串口软件,接收来自单片机的数据 + 串口波特率:9600 + + ```bash + minicom -D /dev/ttyUSB0 -b 9600 + ``` + 5. 运行`process.py`解析数据生成图片 - + ```bash # 新建虚拟环境 virtualenv env diff --git a/SimHei.ttf b/SimHei.ttf new file mode 100644 index 0000000..c5030ae Binary files /dev/null and b/SimHei.ttf differ diff --git a/process.py b/process.py index 2601502..f21b9e8 100644 --- a/process.py +++ b/process.py @@ -21,7 +21,11 @@ for line in lines: timedelta(minutes=int(time_str.split(':')[1])) + \ timedelta(hours=int(time_str.split(':')[0])) temperature = float(temp_str) - if temperature >= 10 and temperature <= 40: + if len(temperatures) > 0: + pre_temp = temperatures[-1] + else: + pre_temp = temperature + if pre_temp-0.5 < temperature < pre_temp+0.5: times.append(time) temperatures.append(temperature) diff --git a/test.py b/test.py new file mode 100644 index 0000000..daf7203 --- /dev/null +++ b/test.py @@ -0,0 +1,3 @@ +import matplotlib +print(matplotlib.matplotlib_fname()) +print(matplotlib.get_cachedir())