I like to understand and know how to write a basic python code to connect and interact with Siemens PLC S7-300 and S7-1200 using Snap7. Please kindly guide me on what to do step by step!
Step 1, learn python.
Step 2, Read the documentation on S7-300 and S7-1200, especially the communication options.
Step 3, Read the documentation on python modules.
Step 4, purchase the appropriate equipment
----------------------------------------------------
Thank you for the reply....all the step 1 to step 4 have been attended to. I need a sample python codes for testing such like Basic Python Code to interact and connect Siemens PLC S7-300 OR s7-1200 using SNAP7
Thank you.
I ran the code and changed the IP to my own but with no result. I ran it, no error but not sure if this is communicating.
import snap7
plc = snap7.client.Client()
plc.connect('192.168.200.24', 0, 3)
# In this example boolean in DB 31 at byte 120 and bit 5 is changed. = 120.5
reading = plc.db_read(31, 120, 1) # read 1 byte from db 31 staring from byte 120
print reading
plc.disconnect()