DEV Array of Multiple Ports of Same Device??
TurnipTruck
Posts: 1,485
Greetings,
I am having trouble with a button event from a DEV array containing devices of the same number with different ports.
In the above example, a button event on occurs on the first device of the array, making nDevice=1. Am I doing something wrong in trying to return a value based on device port numbers?
Thanks!
I am having trouble with a button event from a DEV array containing devices of the same number with different ports.
dvDevice1=[33001:1:0] dvDevice2=[33001:2:0] dvDevice3=[33001:3:0] DEV dDevices[]={dvDevice1,dvDevice2,dvDevice3} BUTTON_EVENT [dDevices,0] { PUSH: nDevice=BUTTON.INPUT.DEVICE.PORT }
In the above example, a button event on occurs on the first device of the array, making nDevice=1. Am I doing something wrong in trying to return a value based on device port numbers?
Thanks!
0
Comments
That is what is in my code. I wrote it wrong in the forum post. Thus I corrected the original forum post.
It still doesn't work though. I only get a button event from the first device of the array.
How about this on your PUSH:
nDevice = dDevices[GET_LAST(dDevices)].PORT
I failed to mention that the devices and array of devices are defined in a main program. The events are in a module that has the device array passed in.
Well, I did it in a simple Netlinx program -- not in a module. Do you need "set_virtual_port_count" in both the module and in the main program? I'm guessing just the module.
I did only in the module. I've since scrapped the idea of what I was doing and went to SEND_COMMANDS.
Thanks for your suggestion! It may just have worked.