Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lego_Robots
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matthew Baxter
Lego_Robots
Commits
07438798
Commit
07438798
authored
Jun 29, 2015
by
Carl Hetherington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Touch sensor.
parent
a8dad347
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
listen.py
listen.py
+6
-0
snap-ev3.xml
snap-ev3.xml
+10
-1
No files found.
listen.py
View file @
07438798
...
@@ -46,6 +46,12 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
...
@@ -46,6 +46,12 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
v
=
f
.
readline
()
.
strip
()
v
=
f
.
readline
()
.
strip
()
f
.
close
()
f
.
close
()
self
.
respond
(
v
)
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
):
class
TCPServer
(
SocketServer
.
TCPServer
):
def
server_bind
(
self
):
def
server_bind
(
self
):
...
...
snap-ev3.xml
View file @
07438798
...
@@ -56,6 +56,15 @@
...
@@ -56,6 +56,15 @@
</block>
</block>
</block>
</block>
</script>
</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>
</block-definition>
</blocks>
</blocks>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment