笔记本电脑和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:\ windows \ system32 \ drivers \ etc \ hosts)(对于Linux是/etc/hosts) 并输入:
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屋!