fb49de922c91,029
http://nhiro.org.s3.amazonaws.com/2/8/288529a48397067012a8ca718fc331a1.jpg https://gyazo.com/288529a48397067012a8ca718fc331a1
(OCR text)
ソースコード
30
import smbus
from time import sleep
bus smbus.SMBus(1)
addr 0x3e
def write(s):
for c in s:
bus.write_byte_data(addr, Ob01000000, char_tablec) def write_deg_mark()
bus.write_byte_data(addr, Ob01000000, Ob11011111)
bus.write_byte_data(addr, Ob01000000, Ob01000011)
data [0x38, 0x39, 0x14, Ox70, 0x56, 0x6c, 0x38,
Ox0c, 0x01]
for d, w in zip(data, wait)
print 'write', hex(d), 'wait', w, 'ms'
bus.write_byte_data(addr, Ob00000000, d)
sleep(w/ 1000.0)
def get_temp()
addr 0x48
v0, v1
temp ((v0 << 8) v1 >> 3) 16.0
return "%2.1f" % temp
bus.read_i2c_block_data(addr, 1, 2)
def cls()
bus.write_byte_data(addr, Ob00000000,
Ob00000001)
'_main_
if name
while True:
cls()
write(get_temp()
write_deg_mark(
sleep(0.5)
char_table {}
for i, c in enumerate('0123456789)
char_tablec= Ob00110000 + i char_table'.' = Ob00101110