Skip to content

Instantly share code, notes, and snippets.

@csik
Created February 19, 2013 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csik/4988995 to your computer and use it in GitHub Desktop.
Save csik/4988995 to your computer and use it in GitHub Desktop.
Ultrabasic code for reading a geiger counter
import serial
#to use the serial library, you need to have pyserial installed, otherwise it won't find the serial library
ser = serial.Serial('/dev/tty.usbserial-A9014NPA',9600)
#Above we create a new serial object
the_time = 0
counter = 0
while(1):
ser.read()
counter = counter +1
print "Time since last click:" + str(time.time() - the_time)
the_time = time.time()
print "Number of clicks since script started: " + str(counter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment