Arduino 如何将字符串用作pinname(nodemcu板)

Arduino 如何将字符串用作pinname(nodemcu板),arduino,webserver,esp8266,arduino-ide,nodemcu,Arduino,Webserver,Esp8266,Arduino Ide,Nodemcu,在这个“w”作为字符串没有给出错误,所以我必须在unit8_8中转换它,比如管脚名称或管脚定义,字符串w=swa,它在设置中定义为管脚名称 如何在pin name中转换它w.toInt()当其字符串和pin也定义为sway时,它的非工作值w=swa。您需要一个查找表将人名转换为pin编号。你可以使用map()。我可以理解你想说的话,我的板是nodeMcu,我正在使用Arduino IDE编程 String sw1 = serv.arg("sw1"); //provid

在这个“w”作为字符串没有给出错误,所以我必须在unit8_8中转换它,比如管脚名称或管脚定义,字符串w=swa,它在设置中定义为管脚名称
如何在pin name中转换它

w.toInt()
当其字符串和pin也定义为sway时,它的非工作值w=swa。您需要一个查找表将人名转换为pin编号。你可以使用map()。我可以理解你想说的话,我的板是nodeMcu,我正在使用Arduino IDE编程
    String sw1 = serv.arg("sw1"); //provide true or false 
    String w = serv.arg("id");    //provide pin name which i have to operate
    if(sw1 == "true")
      digitalWrite(w , HIGH);
    else
      digitalWrite(w , LOW);