通过以太网直接连接笔记本电脑和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.
看起来很聪明 :) 在笔记本电脑上编辑主机表(Windows 为 C:windowssystem32driversetchosts)(Linux 为/etc/hosts)并输入:
To look smart :) edit your hosts table on the laptop (C:windowssystem32driversetchosts 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 访问它
Then you can access it with http://my.arduino
祝你好运
这篇关于通过以太网直接连接笔记本电脑和arduino的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!