使用Ethernet Shield在多个Arduino板之间发送和接收数据的最佳方法是什么?
我是Arduino的新手.我有4个Arduino板,相隔很远.我想在所有这些板之间建立连接,例如,如果触发了一个与Arduino板编号为1的传感器(例如)被触发,它将向所有其他3板发送某种通知以在其他板上执行操作.我打算使用Ethernet Shield,但想知道在使用Arduino配置Ethernet Shields时使用哪种最佳模式,以及如何进行配置.我希望你明白.预先谢谢你.
I'm new to Arduino. I have 4 Arduino boards separated by long distance. I wanted to make connections between all of them so, for example if one sensor connected to Arduino board number 1 (for example) was triggered it will send to all other 3 boards some kind of notification to do action on other boards. I intended to use Ethernet shield but wondered what is the best mode to use when configuring Ethernet Shields with Arduino and how to configure them to do so . I hope you understand. Thank you in advance.
在具有网络屏蔽的Arduino上,您可以启动EthernetServer或WiFiServer.请参阅以太网库的ChatServer示例.
On Arduino with a networking shield you can start an EthernetServer or WiFiServer. See ChatServer example of the Ethernet library.
在具有网络屏蔽的其他Arduino上,您创建一个EthernetClient(或WiFiClient)并将其连接到服务器的IP地址.然后,您打印到客户端的客户端的所有内容都会发送到server.available()返回的服务器的客户端.
On other Arduino with a networking shield you create an EthernetClient (or WiFiClient) and connect it to IP address of the server. Then everything you print to client's Client will be send to server's Client returned by server.available().
您可以使用Telnet客户端测试服务器.
You can test the server with a Telnet client.