Commit 07438798 authored by Carl Hetherington's avatar Carl Hetherington

Touch sensor.

parent a8dad347
......@@ -46,6 +46,12 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
v = f.readline().strip()
f.close()
self.respond(v)
elif len(parts) == 2 and parts[0] == 'touch-sensor' and parts[1] == 'level':
dir = self.find_sensor('lego-ev3-touch')
f = open('%s/value0' % dir, 'r')
v = f.readline().strip()
f.close()
self.respond(v)
class TCPServer(SocketServer.TCPServer):
def server_bind(self):
......
......@@ -56,6 +56,15 @@
</block>
</block>
</script>
<watcher s="IR sensor proximity" style="normal"/>
</block-definition>
<block-definition category="sensing" s="touch sensor level" type="reporter">
<inputs></inputs>
<script>
<block s="doReport">
<block s="reportURL">
<l>localhost:1330/touch-sensor/level</l>
</block>
</block>
</script>
</block-definition>
</blocks>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment