我有2个树莓派设备值。首先是测量温度,第二个是显示它。我写了一些python脚本来管理发送温度结果。无法读取python脚本输出
服务器脚本:
import RPi.GPIO as GPIO
import dht11
import time
import datetime
import sys
# initialize GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.cleanup()
# read data using pin 17
instance = dht11.DHT11(pin=17)
result = instance.read()
out = str(result.temperature) + " " + str(result.humidity)
sys.stdout.write(out)
sys.stdout.flush()
sys.exit(0)
客户端脚本
#!/usr/bin/python
import math
import time
import os
import Adafruit_CharLCD as LCD
# Initialize the LCD using the pins
lcd = LCD.Adafruit_CharLCDPlate()
lcd.set_color(1.0, 1.0, 1.0)
lcd.clear()
ws_dht11 = ""
while True:
ws_dht11 = str(os.system('ssh [email protected] \'python ~/Apps/DHT11_Python/dht11_ssh_read.py\''))
if ws_dht11<>'0 0':
break;
print 'F'
print ws_dht11
问题是与ws_dht11变量。它似乎没有收到任何价值,而不是此服务器脚本正在打印结果。我该如何修复它?
是什么如果ws_dht11 <>'0 0':'。那是甚至有效的Python吗? – Tagc
@Tagc这是相同的SQL <> - 这是同义太=,并且是的,它是有效的Python –
我绿色的蟒蛇,我已经大多采用C++,到目前为止,所以可能有一些共同的东西! – tyrtyrtyrtyr