LER RANGE E ENVIAR PARA VARIÁVEL "TEMPO_LED1" AJAX

Olá pessoal.... preciso da ajuda de vocês....

tenho um controle deslizante tipo "range" na pagina ajax, e gostaria de pegar o valor lido e colocar na variável dentro do Arduino, assim:

VARIÁVEL NO ARDUINO:

unsigned long TEMPO_LED1 = 5000; // 5 segundos

Código html do range:

<input type="range" id="myRange" value="90" min="1" max="180" oninput="document.getElementById('imediatoRange').innerHTML = this.value" />

Esse Range esta configurado para ser posicionado conforme o valor lido na variável, mas não estou conseguindo enviar para o Arduino.

O melhor e mais didático exemplo que encontrei na internet foi esse russo, que aciona o led, mas não consigo colocar pra alterar o TEMPO_LED1.

Desde já agradeço a quem puder ajudar.

Pagina do código Russo

https://esp8266.ru/forum/threads/prikrutit-espfs.1047/

Código Russo: (Funciona direitinho pro led.)

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
 
ESP8266WebServer server(80);
 
const int led = 13;
const char *ssid = "****";
const char *password = "****";
int ledStatus;
 
String javaScript = "<script>\n"
"var xmlHttp=createXmlHttpObject();\n"
"function createXmlHttpObject(){\n"
" if (window.XMLHttpRequest) xmlHttp=new XMLHttpRequest(); else xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');\n"
" return xmlHttp;\n"
"}\n"
"function handleServerResponse(){\n"
" if(xmlHttp.readyState==4 && xmlHttp.status==200){\n"
"   xmlResponse = xmlHttp.responseXML;\n"
"   xmldoc = xmlResponse.getElementsByTagName('led');\n"
"   message = xmldoc[0].firstChild.nodeValue;\n"
"   if (message == '1') document.getElementById('led').innerHTML='Led ON'; else document.getElementById('led').innerHTML='Led OFF';\n"
"   xmldoc = xmlResponse.getElementsByTagName('time');\n"
"   message = xmldoc[0].firstChild.nodeValue;\n"
"   document.getElementById('runtime').innerHTML=message;\n"
" }\n"
"}\n"
"function process(){\n"
" if(xmlHttp.readyState==0 || xmlHttp.readyState==4){\n"
"   xmlHttp.open('PUT','xml',true);\n"
"   xmlHttp.onreadystatechange=handleServerResponse;  //без скобок!\n"
"   xmlHttp.send(null);\n"
" }\n"
" setTimeout('process()',1000);\n"
"}\n"
"function led(set){\n"
" if(xmlHttp.readyState==0 || xmlHttp.readyState==4){\n"
"   xmlHttp.open('PUT','led?set='+set,true);\n"
"   xmlHttp.onreadystatechange=handleServerResponse;  //без скобок!\n"
"   xmlHttp.send(null);\n"
" }\n"
"}\n"
"function led2(set){\n"
" //var set = document.getElementById('set').value;\n"
" server = 'led?set='+set;\n"
" request = new XMLHttpRequest();\n"
" request.open('GET',server,true);\n"
" request.send();\n"
"}\n"
"</script>\n";
 
String millis2time(){
  String Time = "";
  unsigned long ss;
  byte mm,hh;
  ss=millis()/1000;
  hh=ss/3600;
  mm=(ss-hh*3600)/60;
  ss=(ss-hh*3600)-mm*60;
  if(hh<10)Time+="0";
  Time+=(String)hh+":";
  if(mm<10)Time+="0";
  Time+=(String)mm+":";
  if(ss<10)Time+="0";
  Time+=(String)ss;
  return Time;
}
 
void handleWebsite(){
  String webSite = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/><title>ESP8266</title></head><body onload='process()'><span id='runtime'></span>

<span id='led'></span>

<input type='button' value='Led ON' onclick='led(1)'/>

<input type='button' value='Led OFF' onclick='led(0)'/>"+javaScript+"</body></html>";
  server.send(200,"text/html",webSite);
}
 
void handleXML(){
  String xml = "<?xml version='1.0'?><response><led>"+(String)ledStatus+"</led><time>"+millis2time()+"</time></response>";
  server.send(200,"text/xml",xml);
}
 
void handleLed(){
  ledStatus = server.arg("set").toInt();
  Serial.print("Led ");
  Serial.println(ledStatus);
  digitalWrite(led,ledStatus);
  String xml = "<?xml version='1.0'?><response><led>"+(String)ledStatus+"</led><time>"+millis2time()+"</time></response>";
  server.send(200,"text/xml",xml);
}
 
void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();
  pinMode(led,OUTPUT);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid,password);
  while (WiFi.status() != WL_CONNECTED) {Serial.print("."); delay(500);}
  Serial.println();
  Serial.print("Connected to ");
  Serial.print(ssid);
  Serial.print(", station IP address: ");
  Serial.println(WiFi.localIP());
  server.on("/",handleWebsite);
  server.on("/xml",handleXML);
  server.on("/led",handleLed);
  server.begin();
}
 
void loop() {
  server.handleClient();
  delay(1);
}

Onde está o teu código?

Boa noite! Gostaria de implementar uma função para manipular variáveis usando a função FOR. Com base no VBA, tentei rodar o código abaixo o Arduino, mas não é compatível. Alguém poderia me ajudar?

---------- Ideia do código para exemplo --------------

double OutMax;
double Input1, Input2, Input3, Input4 ;
double Output1, Output2, Output13, Output4 ;
double nOutput1, nOutput2, nOutput13, nOutput4 ;

for ( int i=1 ; i<4; i++) {

if(Input(i) < 0)
{
nOutput(i) = 0;
}
else if (Output(i) > OutMax)
{
nOutput(i) = OutMax;
}
else
{
nOutput(i) = Output(i);

}
}