Arduino以太网屏蔽,后LED不会打开

时间:2013-07-02 15:17:15

标签: arduino

我正试图将Arduino的LED引脚13转换为表格贴上的HIGH。当我提交表格时,LED没有任何反应;它保持不动。我错过了什么吗?我正在使用Webduino库。

void setup()
{
  // set LED to OUTPUT
  pinMode(13, OUTPUT); 

  Ethernet.begin(mac, ip);
  webserver.begin();

  webserver.setDefaultCommand(&defaultCmd);
  webserver.addCommand("form", &formCmd);
}

void defaultCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
  outputIndex(server, type);  
}

void outputIndex(WebServer &server, WebServer::ConnectionType type)
{
  P(htmlHead) =
    "<html><head><title>Door Manager</title></head><body>";

  server.httpSuccess();
  server.printP(htmlHead);

  server << "<form action='" PREFIX "/form' method='post'>";
  server << "<input type='submit' value='LED HIGH' /></form>";

  server << "</body></html>";
}

void formCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
  // POST
  if (type == WebServer::POST)
  {
    digitalWrite(13, HIGH);

    // redirect to GET to this same action
    server.httpSeeOther(PREFIX "/form");
  }
  else // GET
    outputIndex(server, type);
}

1 个答案:

答案 0 :(得分:0)

问题是以太网屏蔽使用引脚13,12,11作为SPI。同样是10和4,选择SD或以太网。

Arduino PINs not behaving equaly