def read_partnumber(): mp.init_i2c() mp.i2c_write(0x55, [0x80]) partnumber = mp.i2c_read8bytes(0x55) print partnumber print mp.i2c_read8bytes(0x55) partNum = Entry(frame2) partNum.insert(1, partnumber) partNum.grid(row=10, column=2) mp.close_i2c() return(partnumber)
def read_serialnumber(): mp.init_i2c() mp.i2c_write(0x55, [0x82]) serialnumber = mp.i2c_read8bytes(0x55) serialNum = Entry(frame2) serialNum.insert(1, serialnumber) serialNum.grid(row=11, column=2) mp.close_i2c() return(serialnumber)
def read_partnumber1(): mp.init_i2c() mp.i2c_write(0x55, [0x80]) partnumber = mp.i2c_read8bytes(0x55) # print mp.i2c_read8bytes(0x55) part_Num = Entry(frame1) part_Num.insert(1, partnumber) part_Num.grid(row=6, column=1) mp.close_i2c() return(partnumber)
def read_temp(): mp.init_i2c() m = mp.i2c_write(0x48, [0x55]) print m temp = mp.i2c_read8bytes(0x55) print('############################') print temp print('############################') # print mp.i2c_read8bytes(0x55) temp1 = Entry(frame1) temp1.insert(1, temp) temp1.grid(row=8, column=1) temp2 = Entry(frame1) temp2.insert(1, temp) temp2.grid(row=9, column=1) mp.close_i2c() # temerature = int(((struct.unpack('1B', temp1)[0]/256.0)*100.0)+0.5) return(temp)