1.将两台设备建立通信
参考两台ubuntu电脑如何搭建局域网以及通信
步骤:
1、首先需要知道控制的设备ip地址,比如是
192.168.123.11
2、从settings- netwoork- wired,选择手动,设置ipv4的地址,子网掩码,网关。
地址要和设备在同一网段下,否则不能够ping通。
比如一下设置:
地址:192.168.123.88
子网掩码:255.255.255.0
网关:192.168.123.1
3、在自己的pc端ping设备ip,看是否能够传输数据
ping 192.168.123.11
4、若可以,接下来可以在自己的pc运行代码直接控制设备电机了。
2.传输文件命令
scp XXX.doc nvidia@172.23.100.201:~
解释:
XXX.doc
为文件名nvidia
为对方的用户名172.23.100.201
为对方IP地址:~
后面为传输到对方的文件夹位置- 输入密码为对方的主机密码
3.如何知道自己的IP地址
ifconfig
如果没有ifconfig
命令
使用以下命令安装
sudo apt-get install net-tools
使用示例
-> % ifconfig
enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 9c:2d:cd:6b:d2:80 txqueuelen 1000 (以太网)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xbe180000-be1a0000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (本地环回)
RX packets 5365 bytes 558782 (558.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5365 bytes 558782 (558.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp0s20f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.8.110 netmask 255.255.255.0 broadcast 192.168.8.255
inet6 240e:87c:88c:dc72:679e:8f45:e793:e983 prefixlen 64 scopeid 0x0<global>
inet6 240e:87c:88c:dc72:645f:b3b:9b:6572 prefixlen 64 scopeid 0x0<global>
inet6 fe80::59d6:f884:2026:5fe4 prefixlen 64 scopeid 0x20<link>
ether 3c:e9:f7:b0:17:6f txqueuelen 1000 (以太网)
RX packets 44469 bytes 38582251 (38.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 30959 bytes 12916849 (12.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0