i got issue to discuss
I want to control my instrument, GW Instek GDS-1000A-U with Python using Pyserial Library. So now i want to send *IDN?
to my instrument. So, try to write code like this
import serial
import time
class GDS1000AU :
def __init__(self, port, baudrate, timeout):
self.ser = serial.Serial()
self.port = self.ser.port(port)
self.baudrate = self.ser.baudrate(baudrate)
self.timeout = self.ser.timeout(timeout)
self.ser.open()
if self.ser.is_open == False:
while self.ser.is_open == False :
print("initializing...\n")
time.sleep(0.1)
else:
self.ser.write('*IDN?\n'.encode())
print(self.ser.readline())
GDS1000AU('dev/tty/USB0',9600,1)
i'm expecting return like this
initializing...
initializing...
initializing...
GW, GDS-1152A-U, XXXXXXX, V1.00
those GW, GDS-1152A-U, XXXXXXX, V1.00
line it's mean format ID for my instruments. Anyone agree for my code or want to give comment for my code ? Thank You