質問編集履歴
4
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Pythonのコードは下記のものになります
|
6
6
|
|
7
7
|
|
8
|
-
|
8
|
+
``````````````````````````python
|
9
9
|
import sys
|
10
10
|
import serial
|
11
11
|
from cv2 import cv2
|
@@ -55,4 +55,4 @@
|
|
55
55
|
if __name__ == '__main__':
|
56
56
|
main()
|
57
57
|
|
58
|
-
|
58
|
+
`````````````````````````````````````````````````
|
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
送れなく、リアルタイムで通信ができるやり方があれば教えてください。
|
5
5
|
Pythonのコードは下記のものになります
|
6
6
|
|
7
|
-
----------------------
|
8
7
|
|
8
|
+
''''''''''''''''python
|
9
9
|
import sys
|
10
10
|
import serial
|
11
11
|
from cv2 import cv2
|
@@ -53,4 +53,6 @@
|
|
53
53
|
comport.close()
|
54
54
|
|
55
55
|
if __name__ == '__main__':
|
56
|
-
main()
|
56
|
+
main()
|
57
|
+
|
58
|
+
'''''''''''''''''''''''''''''''''''''''''''''''''
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,7 +13,6 @@
|
|
13
13
|
comport = serial.Serial("COM1", baudrate=115200, parity=serial.PARITY_NONE, timeout=None)
|
14
14
|
|
15
15
|
def data_send(buf):
|
16
|
-
#while(comport.out_waiting == 1):
|
17
16
|
while True:
|
18
17
|
if comport.out_waiting == 0:
|
19
18
|
break
|
1
送り側追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,6 +12,17 @@
|
|
12
12
|
|
13
13
|
comport = serial.Serial("COM1", baudrate=115200, parity=serial.PARITY_NONE, timeout=None)
|
14
14
|
|
15
|
+
def data_send(buf):
|
16
|
+
#while(comport.out_waiting == 1):
|
17
|
+
while True:
|
18
|
+
if comport.out_waiting == 0:
|
19
|
+
break
|
20
|
+
|
21
|
+
data = buf +'\r\n'
|
22
|
+
send_data = data.encode('UTF-8')
|
23
|
+
comport.write(send_data)
|
24
|
+
return
|
25
|
+
|
15
26
|
def data_recieve():
|
16
27
|
|
17
28
|
if(comport.in_waiting > 0):
|
@@ -31,7 +42,9 @@
|
|
31
42
|
ret, frame = cap.read()
|
32
43
|
recieve_data = data_recieve()
|
33
44
|
|
34
|
-
print(recieve_data)
|
45
|
+
print(recieve_data)
|
46
|
+
data_send(recieve_data)
|
47
|
+
|
35
48
|
|
36
49
|
cv2.imshow('img',frame)
|
37
50
|
|