import pyvisa
import sys
from fn_gen import DG2052

if __name__ == "__main__":
    rm = pyvisa.ResourceManager()
    resources = rm.list_resources() # list available resources
    if len(resources) == 0:
        print("No Resources Found!")
        sys.exit(1)
    else:
        print(f"Available Resources: {resources}")
        port = resources[0] # Select the first resource
        inst = DG2052(port)
        print(inst.whoami())
