From 576936961996253c5a7ea27b63e5bb2ce0bb01aa Mon Sep 17 00:00:00 2001 From: manojgudi Date: Tue, 24 Dec 2013 21:07:36 +0530 Subject: Aded SBHS block --- gr-sbhs/python/testing.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 gr-sbhs/python/testing.py (limited to 'gr-sbhs/python/testing.py') diff --git a/gr-sbhs/python/testing.py b/gr-sbhs/python/testing.py new file mode 100755 index 000000000..a71655b40 --- /dev/null +++ b/gr-sbhs/python/testing.py @@ -0,0 +1,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) + +''' -- cgit