Line | |
---|
1 | import threading
|
---|
2 | import GlobalVariables
|
---|
3 | import serial
|
---|
4 | import time
|
---|
5 | import datetime
|
---|
6 |
|
---|
7 |
|
---|
8 | class 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.