bicarlsen / easy-scpi

A library to control SCPI instruments
GNU General Public License v3.0
53 stars 20 forks source link

Add a proper full example to using the easy-scpi library to make it "easy" #12

Closed calumroy closed 8 months ago

calumroy commented 1 year ago

Your example in the readme is confusing for beginners who don't know about VISA. What should "\<port>" look like in

# Connect to an instrument
inst = scpi.Instrument( <port> )

e.g I have a device I want to talk scpi comms to over tcp/ip on ip address 169.254.89.0 port 5025.

Trying these all fail:

inst = scpi.Instrument( "169.254.89.0:5025" , read_termination='\n', write_termination='\n')
inst = scpi.Instrument("169.254.89.0", read_termination='\n', write_termination='\n')
inst = scpi.Instrument("TCPIP0::169.254.89.0::5025::SOCKET", read_termination='\n', write_termination='\n')

What is a concrete example for the value ?

I eventually found that this worked:

inst = scpi.Instrument(read_termination='\n', write_termination='\n')
inst.rid="TCPIP0::169.254.89.0::5025::SOCKET"

Can you add an explanation to setting the rid in the readme if this is the correct connection method for tcp/ip case or explain the scpi.Instrument( <port> ) better.

bicarlsen commented 1 year ago

Thank you for the suggestion. I'll get around to this when I can, but am quite busy these days so don't know when that will be. If you're up for it, you can create a PR and either add an examples folder or add it into the README.