Skip to content

Instantly share code, notes, and snippets.

@dansteingart
Created September 12, 2013 20:52
Show Gist options
  • Save dansteingart/6543616 to your computer and use it in GitHub Desktop.
Save dansteingart/6543616 to your computer and use it in GitHub Desktop.
Keithley and Python
import serial
from glob import glob
port = glob("/dev/tty.u*")[0]
ser = serial.Serial(port,57600)
ser.open()
ser.timeout = .5
def write(string):
ser.write(string+"\r\n")
def read():
return ser.readlines()
write("*CLS\r\n")
write("*IDN?\r\n")
print read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment