笔记本电脑和arduino之间通过以太网直接连接 [英] Direct connection between laptop and arduino via ethernet
问题描述
我用 Arduino 和以太网屏蔽做了一个项目.Arduino 正在托管一个网站,我可以通过笔记本电脑上的浏览器打开该网站.Arduino 通过以太网连接到路由器.所有这些都很好.
I made a project with the Arduino and the ethernet-shield. The Arduino is hosting a website which I can open via the browser on my laptop. The Arduino is connected to the router via ethernet. All of this works just fine.
现在我必须在学校展示这个项目.为了防止出现令人不快的意外,我想通过以太网将 Arduino 直接连接到笔记本电脑.我的问题是我真的不了解这个话题.如果可能,请告诉我该怎么做.
Now I have to present this project at school. To prevent unpleasant surprises I wanted to connect the Arduino directly with the laptop via ethernet. My problem is that I am really not well informed about this topic. Please, if possible, tell me what I should do.
推荐答案
如果您将路由器从环路中移除,您将需要:
If you take the router out of the loop you will need to:
为笔记本电脑的以太网连接分配一个手动 IP 地址,比如 192.168.0.1
Assign a manual IP address to the laptop's Ethernet connection say 192.168.0.1
子网掩码 255.255.255.0
Subnet mask 255.255.255.0
为 Arduino 的以太网分配一个手动 IP 地址,比如 192.168.0.2
Assign a manual IP address to the Arduino's Ethernet say 192.168.0.2
子网掩码 255.255.255.0
Subnet mask 255.255.255.0
默认网关为空
使用交叉电缆将两者连接起来(标准跳线不起作用)
Use a cross-over cable to link the two (a standard patch lead will NOT work)
然后,您应该可以通过笔记本电脑在 http://192.168.0.2
上启动您的 Arduino 站点.
You should then be able to get your Arduino site up on http://192.168.0.2
from the laptop.
为了看起来聪明:) 在笔记本电脑上编辑你的主机表(C:\windows\system32\drivers\etc\hosts for windows)(/etc/hosts for linux)并输入:
To look smart :) edit your hosts table on the laptop (C:\windows\system32\drivers\etc\hosts for windows) (/etc/hosts for linux) and make an entry:
192.168.0.2 my.arduino
192.168.0.2 my.arduino
然后你可以使用http://my.arduino
祝你好运
这篇关于笔记本电脑和arduino之间通过以太网直接连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!