Set Gpio mode to output before changing it

This commit is contained in:
Mathieu Maret 2016-03-10 23:16:51 +01:00
parent b9b8253adc
commit 1e20d8a397

View File

@ -72,8 +72,8 @@ void handleGpio() {
return;
}
digitalWrite(server.arg("gpio").toInt(), server.arg("value").toInt());
pinMode(server.arg("gpio").toInt(), OUTPUT);
digitalWrite(server.arg("gpio").toInt(), server.arg("value").toInt());
server.send(200, "text/html", "<h1>GPIO" + server.arg("gpio") + " changed to " + server.arg("value") + "</h1>");
}