我有c++服务器和Arduino UNO客户端与以太网盾。我的问题是,服务器会检测任何断开的连接(c#服务器、安卓应用程序),除了Arduino服务器。无缘无故,我猜Arduino插座仍然在运行,即使Arduino没有电源。这是Arduino代码:
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 4);
EthernetClient client;
void setup()
{
Serial.begin(9600);
while (!Serial)
{
;
}
if (Ethernet.begin(mac) == 0)
{
Serial.println("Failed to configure Ethernet using DHCP");
Ethernet.begin(mac, ip);
}
delay(1000);
Serial.println("connecting...");
if (client.connect("192.168.1.11", 1626))
{
Serial.println("connected");
}
else
{
Serial.println("connection failed");
}
}
void loop()
{
client.write("hello", strlen("hello")+1);
if (!client.connected())
{
Serial.println("connection failed");
client.stop();
return;
}
}在没有电源的情况下,Arduino如何自动关闭插座?
发布于 2016-04-23 00:38:23
只有Arduino的,你不能。当Arduino没有电源时,它无法自动关闭它的插座。Arduino不像笔记本电脑或Android,因为它们有自己的电池组,几乎没有大脑做出相应的反应。而且,可怜的东西甚至不知道什么时候会断电。
然而,,这是可以做到的。给你的Arduino一个自己的能量银行。
https://stackoverflow.com/questions/36794802
复制相似问题