jgv276 Posted September 24, 2008 Share Posted September 24, 2008 Hello I need to do a sequence to write on different channels ethernet. I can't use the "device.MyDevice.Write ()" because I can't change the value of "MyDevice." I'm making in this way, but it is unsafe. DIGOUT.strDevice = "MyDevice" + number DIGOUT.Timing = 2 channel.Restart() delay(0.3) DIGOUT.Timing = 0 channel.Restart() That way I can write in ... MyDevice1 MyDevice2 ... Surely there is a better method I hope I have explained my problem and that can help me. Thanks in advance Link to comment Share on other sites More sharing options...
AzeoTech Posted September 24, 2008 Share Posted September 24, 2008 There are a couple ways, if I'm understanding what you want to do: 1) change the IP or the port of MyDevice between each query: device.mydevice.strAddress = "10.0.0.2" device.mydevice.initcomm() device.mydevice.write(...) device.mydevice.strAddress = "10.0.0.3" device.mydevice.initcomm() device.mydevice.write(...) You may need a delay between initcomm() and write(). 2) Use the execute() function to build up your commands: execute("device.mydevice" + doubletostr(number) + ".write(...)") Link to comment Share on other sites More sharing options...
jgv276 Posted September 24, 2008 Author Share Posted September 24, 2008 I appreciate your help. Well I think that is easier the function "execute". I will try with both Thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.