Skip to content

Instantly share code, notes, and snippets.

@MercuryRising
Created February 3, 2013 01:19
Show Gist options
  • Save MercuryRising/4700070 to your computer and use it in GitHub Desktop.
Save MercuryRising/4700070 to your computer and use it in GitHub Desktop.
#/usr/bin/python
import serial
import time
import sys
extruderSetPoint = 345
bedSetPoint = 6300
ser = serial.Serial("/dev/ttyUSB0", 115200)
ser.write("1")
# should hear relay click now, but I don't
while True:
line = ser.readline()
data = line.split(" ")
if len(data) > 7:
extruderResistance = float(data[3])
bedResistance = float(data[-1].strip())
if extruderResistance < extruderSetPoint and bedResistance < bedSetPoint:
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment