| Listing 2. Code snippet using Snap7 to extract a variable from a PLC. |
|
db_number = 129
start_byte = 0 client = snap7.client.Client() client.connect(PLC_IP, rack=0, slot=2) byte_array = client.db_read(db_number, start_byte, 4) value = snap7.util.get_real(byte_array,0) |