Exemple #1
0
#slave_ids = find_slave_id()
slave_ids = [1,2]
uid = str(getuvid())
print(uid)
path = '/root/orangepizerodelta/'
path = ''
file_name = path + uid + '.csv'
temp_file = path + 'temp.csv'

file_name = path + uid + '.csv'
temp_file = path + 'temp.csv'
print(file_name)


if not os.path.exists(path + uid+".csv"):
    createfile(path + uid+".csv")
    print("file created")


def initmodbusandread(i):
    try:
        if (registers.get(i)[4]["send"]) is True:
            print(i)
            instrument = mb.Instrument('/dev/ttyS1', slave_id)
            instrument.serial.baudrate = 9600  # Baud
            instrument.serial.bytesize = 8
            instrument.serial.stopbits = 1
            instrument.serial.timeout = 2  # seconds
            instrument.address = slave_id   # this is the slave address number
            instrument.mode = mb.MODE_RTU   # rtu or ascii mode
            read(i, instrument)
Exemple #2
0
import save
import uvid

uvid = uvid.getuvid()
file_name = str(uvid) + '.csv'

save.createfile(file_name)