Support Portal

How to activate Pin2 or Pin4 of the SIG350 using Phyton

A description of how to activate Pin2 or Pin4 of the SIG350 using Phyton
Related Products
SIG350
Attachments
Skript mit der Eingabe über Terminal.txt

Table of Contents

The SIG350 requires a prober IP address, and the ports and pins that you want to switch must be set as digital outputs via the SIG350 web interface.

 

When we start with the phyton script, you need to include the library opcua in your phyton installation and the objects client and ua from opcua in your project.

 

 

Now we need to establish a connection from the SIG350 to the OPC UA server.

To do this, we create a variable with the name url, which contains the IP address of the SIG350.

Then we create a variable client that contains all the connection information

 

 

The next step is to call the force ID. This force ID is only valid for 10 seconds. After this time, you need a new force ID.

The method to call the force ID is this

You can find out the node ID using the UA Expert tool, for example.
method_forceID is the node ID of the force function. The parent_forceID is the node ID of the parent. Then call up the force_ID

 

 

Now you have to set the output.

The parent ID is the same node ID as the parent ID from the forcing ID.
There are now three values that you need for this function.
The first value is the force ID that you called before, it is of type UInt32.

The second value is the mask, with this value you enable the output, the type is byte, the value in here is a bit to decimal conversion depending on the port. If you want to activate everything, write 255 (all 8 bits are true).
The third value is to turn the pin on and off, the type is byte, the value in here depends on the port a bit to decimal conversion. For example, if you want to set port 2 to true, you must write a 2, if you want to switch port 3, you must write a 4 and so on.
Then call the method.

 

Attached you will find the complete source code.

Keywords:
sig350, phyton, pin4, pin2