Beispiel #1
0
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)
Beispiel #2
0
def read_deckstatus():
    mp.init_i2c()
    mp.i2c_write(0x55, [0x05])
    deckstatus = mp.i2c_read(0x55)

    if not(deckstatus):
        deckstatus = struct.pack('1B', 0x00)
    mp.close_i2c()
    return deckstatus.encode('hex')
Beispiel #3
0
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)
Beispiel #4
0
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)
Beispiel #5
0
def read_statusheater():
    mp.init_i2c()
    mp.i2c_write(0x55, [0x07])
    heaterstatus = mp.i2c_read(0x55, 1)
    input_Heater = Listbox(frame1, height=1)
    input_Heater.insert(1, heaterstatus)
    input_Heater.grid(row=4, column=1)
    print heaterstatus
    mp.close_i2c()

    return (heaterstatus)
Beispiel #6
0
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)
Beispiel #7
0
def write_deckstatus(status=0x00):
    mp.init_i2c()
    mp.i2c_write(0x55, [0x05, status])
    deckstatus = mp.i2c_read(0x55)
    mp.close_i2c()
    return deckstatus.encode('hex')
Beispiel #8
0
Label(frame3, text="Supply ID : ").grid(row=1)
tk.Label(frame3, text="Voltage").grid(row=2)
tk.Label(frame3, text="Current").grid(row=3)
tk.Label(frame3, text="Show").grid(row=4)
E1 = tk.Entry(frame3, width=20)
E2 = tk.Entry(frame3, width=20)
E1.grid(row=2, column=1)
E2.grid(row=3, column=1)
listbox = tk.Listbox(frame3, height=2)
# vOUT = allOutput()
# iOut = output_current()
# listbox.insert(1, vOUT)
# listbox.insert(2, iOut)
listbox.grid(row=4, column=1)
ON = tk.Button(frame3, text="ON", width=10, command=lambda: [
    input_volt(), input_current(), allOutput()])
ON.grid(row=5, column=0, columnspan=2, sticky=W)
OFF = tk.Button(frame3, text="OFF", width=10, command=lambda: [OFF_volt(), OFF_current()])
OFF.grid(row=5, column=1, columnspan=2, sticky=E)

# read_deckstatus()
# mp.i2c_write(0x55, [0x05])
# deckstatus = mp.i2c_read(0x55)
# print deckstatus
# read_partnumber()
port = func()

mp.close_i2c()

root.mainloop()