How to send internet packets between two Arduinos?

2019-09-19 09:31发布

问题:

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

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.

回答1:

there a mutliple ways of communication over the internet.

  • 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().