Exemplo n.º 1
0
	def __init__ (self, name, addr=None, busNr=None):
		self.device = i2cDevice(name, addr, busNr)

		self.setDebug(True)
	
		return None
Exemplo n.º 2
0
 def __init__(self):
     comports = list(serial.tools.list_ports.comports())
     for i in range(len(comports)):
         if "FTDIBUS\\VID_0403+PID_6001+FTGNULUEA\\0000" in comports[i]:
             PORT = comports[i][0]
     self.i2c = i2cDevice(PORT)
Exemplo n.º 3
0
#!/usr/bin/env python3
import fcntl
from i2cBus import i2cBus
from i2cDevice import i2cDevice

class i2cMaster (i2cDevice):
	device = None
	
	def __init__ (self, name, addr=None, busNr=None):
		self.device = i2cDevice(name, addr, busNr)

		self.setDebug(True)
	
		return None

if __name__=="__main__":
	masterAddress = 0x60

	master = i2cDevice("Master")

	master.bus.beginTransmission()

	master.bus.endTransmission()

Exemplo n.º 4
0
    def __init__(self, name, addr, busNr=None):
        self.address = addr
        self.device = i2cDevice(name, addr, busNr)
        self.setDebug(True)

        return None
Exemplo n.º 5
0
            temp = temp - .125
        if binary_string[11] == '1':
            temp = temp - .0625

        temp = temp * -1

    return temp


def getTempF(temp):
    temp = temp * 1.8
    temp = temp + 32
    return temp


x = i2cDevice.i2cDevice("COM7")
x.open()

if (x.isOpen()):
    x.write("S9EAA")
    time.sleep(0.5)
    x.write("R02")
    time.sleep(0.5)
    msb = x.read(1)
    lsb = x.read(1)

    msbInt = int(binascii.hexlify(msb), 16)
    lsbInt = int(binascii.hexlify(lsb), 16)

    msbstr = bin(msbInt)[2:].zfill(8)
    lsbstr = bin(lsbInt)[2:].zfill(8)
Exemplo n.º 6
0
			 temp = temp - .25
		 if binary_string[10] == '1':
			 temp = temp - .125
		 if binary_string[11] == '1':
			 temp = temp - .0625

		 temp = temp * -1
		 
	return temp
	
def getTempF(temp):
        temp = temp * 1.8
        temp = temp + 32
        return temp

x = i2cDevice.i2cDevice("COM7")
x.open()

if (x.isOpen()):
	x.write("S9EAA")
	time.sleep(0.5)
	x.write("R02")
	time.sleep(0.5)
	msb = x.read(1)
	lsb = x.read(1)
	
	msbInt = int(binascii.hexlify(msb), 16)
	lsbInt = int(binascii.hexlify(lsb), 16)
	
	msbstr = bin(msbInt)[2:].zfill(8)
	lsbstr = bin(lsbInt)[2:].zfill(8)
Exemplo n.º 7
0
 def __init__(self):
     comports = (list(serial.tools.list_ports.comports()))
     for i in range(len(comports)):
         if 'FTDIBUS\\VID_0403+PID_6001+FTGNULUEA\\0000' in comports[i]:
             PORT = comports[i][0]
     self.i2c = i2cDevice(PORT)
Exemplo n.º 8
0
#!/usr/bin/env python3
import fcntl
from i2cBus import i2cBus
from i2cDevice import i2cDevice


class i2cMaster(i2cDevice):
    device = None

    def __init__(self, name, addr=None, busNr=None):
        self.device = i2cDevice(name, addr, busNr)

        self.setDebug(True)

        return None


if __name__ == "__main__":
    masterAddress = 0x60

    master = i2cDevice("Master")

    master.bus.beginTransmission()

    master.bus.endTransmission()