Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
osie
Commits
b69ceff9
Commit
b69ceff9
authored
Oct 05, 2020
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn on / off to 50 milliseconds air valavel.
parent
f4a4afa9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
eggs/osie_plc/osie_ocr.py
eggs/osie_plc/osie_ocr.py
+9
-5
No files found.
eggs/osie_plc/osie_ocr.py
View file @
b69ceff9
...
@@ -7,8 +7,11 @@ import cv2
...
@@ -7,8 +7,11 @@ import cv2
import
numpy
as
np
import
numpy
as
np
import
pymodbus
import
pymodbus
from
pymodbus.client.sync
import
ModbusTcpClient
as
ModbusClient
from
pymodbus.client.sync
import
ModbusTcpClient
as
ModbusClient
UNIT
=
0x1
from
time
import
sleep
UNIT
=
0x1
OSIE_PLC_ADDRESS
=
"localhost"
# "192.168.0.48" for real machine
OSIE_PLC_PORT
=
502
def
nothing
(
x
):
def
nothing
(
x
):
# any operation
# any operation
pass
pass
...
@@ -17,12 +20,13 @@ def sendModbusCommand():
...
@@ -17,12 +20,13 @@ def sendModbusCommand():
"""
"""
XXX: Pure example.
XXX: Pure example.
"""
"""
client
=
ModbusClient
(
'localhost'
,
port
=
502
)
client
=
ModbusClient
(
OSIE_PLC_ADDRESS
,
port
=
OSIE_PLC_PORT
)
client
.
connect
()
client
.
connect
()
rr
=
client
.
read_coils
(
1
,
1
,
unit
=
UNIT
)
#rr = client.read_coils(1, 1, unit=UNIT)
client
.
write_coils
(
1
,
[
not
rr
.
bits
[
0
]],
unit
=
UNIT
)
client
.
write_coils
(
1
,
[
True
],
unit
=
UNIT
)
sleep
(
0.05
)
client
.
write_coils
(
1
,
[
False
],
unit
=
UNIT
)
client
.
close
()
client
.
close
()
#sendModbusCommand()
cap
=
cv2
.
VideoCapture
(
1
)
cap
=
cv2
.
VideoCapture
(
1
)
cv2
.
namedWindow
(
"Trackbars"
)
cv2
.
namedWindow
(
"Trackbars"
)
...
...
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