source: trigger/ReadTemperatures.py@ 9492

Last change on this file since 9492 was 149, checked in by daqct3, 15 years ago
Changes to two .py files
File size: 1.3 KB
Line 
1import threading
2import GlobalVariables
3import serial
4import time
5import datetime
6
7
8class ReadTemperatures(threading.Thread):
9
10
11
12 filename=""
13
14 def run(self):
15 time.sleep(0.01)
16 while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
17 MyTime = time.time()
18 hour = time.gmtime(MyTime)[3]
19 if(hour>=13):
20 MyTime+=12*60*60
21 year = time.gmtime(MyTime)[0]
22 month =time.gmtime(MyTime)[1]
23 day = time.gmtime(MyTime)[2]
24 date=str(year)
25 #if (hour>=12):
26 # day = day+1
27
28
29 date+="%(month)02d" % {"month":month}
30 date+="%(day)02d" % {"day":day}
31 #date+="_"
32 #date+="%(hour)02d" % {"hour":hour}
33 #date+="%(minute)02d" % {"minute":minute}
34 self.filename="/ct3data/SlowData/CLIM_"+date+".slow"
35 file = open(self.filename, 'r')
36 #ArduinoMessage = self.ser.readline()
37 Lines= file.readlines()
38 lastline=Lines[-1]
39 #print Lines[-1]
40 file.close()
41
42 Message = lastline[lastline.find('['):]
43 GlobalVariables.ServerMessage = Message
44 #print Message
45 time.sleep(15)
46
47
48
49
50
51
52
53
Note: See TracBrowser for help on using the repository browser.