-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
348 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
# coding:utf-8 | ||
# // An highlighted block | ||
import traceback | ||
import socket | ||
import time | ||
import sys | ||
# RPi's IP | ||
SERVER_IP = "192.168.10.115" # 输入正确的目标ip地址,请查看树莓派ip | ||
SERVER_PORT = 9000 | ||
|
||
print("Starting socket: TCP...") | ||
|
||
print("Please input!") | ||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
sock.connect((SERVER_IP, SERVER_PORT)) # 打开链接 | ||
444 | ||
sock.sendall(str.encode("12312")) | ||
received = sock.recv(1024) | ||
print("read: " + received.decode()) | ||
while True: | ||
try: | ||
# | ||
# if len(data)>0: | ||
command = input() | ||
command += '\n' | ||
print("send: " + command) | ||
try: | ||
sock.sendall(str.encode(command)) | ||
received = sock.recv(1024) | ||
print("read: " + received.decode()) | ||
except ConnectionRefusedError: | ||
print('error') | ||
sock.close() | ||
pass | ||
except BlockingIOError: | ||
pass | ||
except: | ||
pass | ||
|
||
except Exception: | ||
# print("exception") | ||
print(traceback.format_exc()) | ||
sys.exit(1) | ||
from pymycobot.mycobotsocket import MyCobotSocket | ||
m = MyCobotSocket("192.168.10.115", "/dev/ttyAMA0", "1000000") | ||
print(m.send_command("get_coords")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.