I am trying to send a (modbus) signal to an external device via the toolbar without the program running. I tried the code from this article for this, but it doesn’t seem to work.
I have taken over the scriptSender and the scriptCommand from JBM without changing anything here. I expect this is where the error is, but it is not clear to me whether or not I should change anything. As soon as I change the ip address to the ip address of my external device ursim crashes.
Usually if your simulator freezes/crashes when sending scripts like that, it’s because you’ve got a small typo in the String. I can’t tell you how many times I’ve crashed my sim because I forgot a ).
Easiest way to double check is to print the command you’re sending before you send it.
System.out.println(pushCommand);
Add that and take a close look at the printout to verify it’s sending EXACTLY what you want it to send
Thank you for your quick response! I worked on it and did find and eliminate a bug. Unfortunately, that was not the fix that makes the program work…
The signal itself does work at runtime, but not yet outside of it. I have put everything into a try and catch and in that everything seems to work fine as well. The signal is also stored properly in the variable.
@eric.feldmann Yeah I used the exact same code in the scriptwriter and then it is working. But I tried it to be sure and it helped! Sometimes the solutions can be so easy.
Thankyou for your time and help again.