blob: a71655b40b7c5197d2f3c2e0234ea7f0d071e4ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/python -tt
import serial
import time
from time import sleep
ser = serial.Serial('/dev/ttyUSB0', baudrate=9600, timeout=1)
ser.open()
from time import sleep
import urllib
import urllib2
from sbhs import *
#from bottle import *
from scan_machines import *
new_device = Sbhs()
new_device.connect(252)
new_device.connect_device(0)
for i in range(10):
#new_device.setHeat(10)
#new_device.setFan(30)
f=new_device.getTemp()
print f
time.sleep(3)
ser.close()
#f = 10
#@route('/temp')
#def hello():
# return str(f)
#run(host='localhost', port=8080, debug=True)
'''
#writing to google app-engine
data = {}
data['temp'] = '30'#float value not int
data['heat'] = '200'
data['fan'] = '100'
url_val = urllib.urlencode(data)
print url_val
url = 'http://remote-cloudlabs.appspot.com/hello'
full_url = url + '?' + url_val
data = urllib2.urlopen(full_url)
#reading from url
req = urllib2.Request('http://remote-cloudlabs.appspot.com/display')
response = urllib2.urlopen(req)
data = response.read()
print data
time.sleep(10)
'''
|