Beispiel #1
0
 def handle(self, *args, **options):
     ser = serial.Serial(dev, 9600, timeout=2)
     ser.setRTS(True)
     ser.setRTS(False)
     while True:
         try:
             line = ser.readline()
             ts = datetime.now()
             l = line.split("\t")
             x, y, z = tuple(l)
             r = Reading(x=x, y=y, z=z, timeStamp=ts)
             r.save()
         except Exception, e:
             print e
Beispiel #2
0
 def __init__(self):
     ser = serial.Serial(dev, 57600, timeout=2)
     ser.setRTS(True)
     ser.setRTS(False)
     while True:
         try:
             line = ser.readline()
             # print line
             ts = datetime.now()
             l = line.split("\t")
             x, y, z = tuple(l)
             r = Reading(x=x, y=y, z=z, timeStamp=ts)
             r.save()
         except Exception:
             pass
     ser.close