File: hp6632b_serial.py

package info (click to toggle)
python-scpi 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292 kB
  • sloc: python: 912; sh: 26; makefile: 3
file content (21 lines) | stat: -rwxr-xr-x 574 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
"""Example/test script for using the HP 6632B power supply via serial interface"""
import atexit
import os
import sys

from scpi.devices import hp6632b
from scpi.wrapper import AIOWrapper

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print(f"run with python -i {__file__} /dev/ttyUSB0")
        sys.exit(1)
    # Then put to interactive mode
    os.environ["PYTHONINSPECT"] = "1"
    aiodev = hp6632b.rs232(sys.argv[1], rtscts=True, baudrate=9600)
    dev = AIOWrapper(aiodev)

    atexit.register(dev.quit)

    print(dev.identify())