python - 使用 Raspberry Pi 3 的 Full Weather Station 使用 Python 编写的难题
问题描述
我正在尝试使用 Raspberry Pi 3 建立气象站代码将用 Python 编写 Raspberry Pi 将直接与 Adafruit DHT-22 传感器、BMP-180 传感器和 DS18B20 传感器连接远程站将使用ESP-8266 和 Raspberry Pi 将从 Open Weather Maps 进行测量,这将是一个 GUI,并且测量结果将显示在 Thinkspeak 上(对于 IOT 部分)我现在的问题是我想显示来自传感器,但我也想显示与 ESP-8266 传感器和开放天气图的区别
#类似这样的事情#“站和卫星的温差是……”#or#“测量值相等”
有没有办法在 Python 中创建一个命令,因为 Pycharm 对我的代码不满意......
import Adafruit_DHT
import pyowm
DHT22Sensor = Adafruit_DHT.DHT22
DHTpin = 16
humidity_indoors, temperature_indoors = Adafruit_DHT.read_retry(DHT22Sensor, DHTpin)
degree_sign = u'\N{DEGREE SIGN}'
owm = pyowm.OWM('')
observation = owm.weather_at_place('Larissa, GR')
weather_sat = observation.get_weather()
status_sat = weather.get_detailed_status()
temperature_sat = weather.get_temperature('celsius')['temp']
wind_sat = weather.get_wind('miles_hour')['speed']
humidity_sat = weather.get_humidity()
def mphtokmh(wind):
kmh = (float)(wind * 1.60)
return kmh
if humidity_indoors is not None and temperature_indoors is not None :
print('Temp={0:0.1 f} * C Humidity={1:0.1 f}%' .format(temperature_indoors, humitity_indoors))
else :
print('Failed to get reading, Try Again!')
print("The Sky is...{}".format(status_sat))
print("the temperature in our town is...{}C".format(temperature_sat))
print("the windspeed is...{}Km/h".format(wind_sat))
print("humid is...{}"%.format(humitity_sat))
if temperature_sat==temperature_indoors
print("No Difference to show")
if temperature_sat>temperature_indoors
print(temperature_sat)
if temperature_sat<temperature_indoors
print(temperature_indoors)
(ps这只是一个测试代码)
解决方案
推荐阅读
- c# - 是否有一个属性可以为每个函数添加正确的响应类型属性
- postgresql - 选择持续时间段的模式
- android - GPUMp4Composer 应用过滤器
- powerbi - 如何仅选择每个表格视觉对象中的一项
- mysql - 将特定列存储和检索到包含存储过程中单行的结果集的变量中
- java - 为什么我在控制器中收到来自邮递员请求的空值?
- android - 如何将带有invokeMethod的字符串数组从Native传递到flutter
- node.js - 通过 npm start 运行时访问被拒绝,但运行 `node www.js` 时一切正常
- reactjs - Normalizr :如果 id 存在,则仅将项目添加到项目数组
- c++ - 请解释为什么这个简单的 C++(Qt) 代码如此奇怪