如何在两个 Arduinos 之间发送互联网数据包? [英] How to send internet packets between two Arduinos?

查看:44
本文介绍了如何在两个 Arduinos 之间发送互联网数据包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在进行的一个项目,我想知道是否有办法在两个 Arduino 之间发送互联网数据包.

For a project I am working on, I am wondering if there is a way to send internet packets between two Arduinos.

设置是让两个 Arduino 都有以太网屏蔽.一个屏蔽连接到计算机,另一个连接到路由器或其他互联网连接.Arduinos 需要相互通信以中继信息包.目标是能够通过这两个 Arduinos 从我的电脑 ping 路由器.

The setup would be to have both Arduinos have ethernet shields. One shield is connected to a computer and the other to a router or other internet connection. The Arduinos need to communicate to each other relaying the packets of information. The goal is to be able to ping the router from my computer through these two Arduinos.

任何帮助将不胜感激.谢谢.

Any help would be greatly appreciated. Thank you.

推荐答案

互联网上有多种沟通方式.

there a mutliple ways of communication over the internet.

  • UDP 库使用起来非常容易和简单,但是没有验证包是否收到...(Arduino 库有一个 UDP 类)
  • 使用客户端类Arduino one 是服务器,Arduino 2 是客户端.例如:一个 arduino 使用 server.print(data) 发送一个字符串/数据包,另一个使用 client.read() 接收它.
  • UDP library Very easy and simple to use, but there is no validation if the packages received or not... (The Arduino library has a UDP class)
  • Using the client class Arduino one is a server and Arduino 2 a client. For example: one arduino sends a string/packet using server.print(data) the other receives it using client.read().

这篇关于如何在两个 Arduinos 之间发送互联网数据包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆