The main()
function as you have written should return the list of values to be written to the CSV file. For e.g.
def main( ):
plc = OmronPLC( )
ip = plc.openFins('ip_address', port)
d2000 = plc.readMemC('D2000', 2)
d2005 = plc.readMemC('D2005', 5)
plc.close ( )
print ip, d2000, d2005
return [ip, d2000, d2005]