現在、USB Weatherboard V3 を使用しています。
データは、/dev/ttyUSB* から 1 秒ごとに継続的に送信されます ... PySerial でデータを取得しようとしましたが、それでも失敗しました。
出力コンソールで「RESET」を取得できます。データを取得できません。
私が欲しいのは、次のような出力です:
SHT15 temperature: 2.5 75.1 deg F
SHT15 humidity: 65%
SHT15 dewpoint: 62.7 deg F
BMP085 pressure: 2 2011, 10:05:235.967 in Hg FAIL
BMP085 temperature: 75.3 deg F
TEMT6000 light: 0.1%
Weather meters wind speed: speci0.0 MPH FAIL
Weather meters wind direction: -1 degrees FAIL
Weather meters rainfall: 0.00 inches FAIL
External power: 0.00 Volts FAIL
^ minicom (unix シリアル プログラム) から来ています。
誰かが私を助けることができますか?
ところで、これは現在私のコードです:
import serial;
import io;
import time;
import os;
# Weather board script #
if __name__ == '__main__' :
try :
print '===================================\n'
print 'USB Weatherboard V3 - Python Script'
print 'Connection datasheet : '
print '(+) Port : /dev/ttyUSB0'
print '(+) Baud rate : 9600'
print '(+) Type : 8N1'
print '===================================\n'
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=1, xonxoff=False, rtscts=False, dsrdtr=True)
while True :
arr = ser.readlines()
for strarr in arr :
s = strarr.decode('cp1252').replace('\00','')
#s2 = s.encode('ascii');
s2 = s
if s2[1:3] != '[H' :
print s2
pass
pass
pass
except :
print 'Program exit !'
pass
finally :
ser.close()
pass
それを修正するのを手伝ってください。または、私の前にコードを書いている人がいる場合は、私と共有してください:)
Weatherboard v3 データシート: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Weather/USB_Weather_Board_V3_datasheet_110615.pdf
Weatherboard v3 製品 : https://www.sparkfun.com/products/10586