<html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" c initial-scale=1.0" /> <title>NodeMCU Car Remote</title> <style> .btn { display: inline-block; margin: 10px; padding: 10px 20px; font-size: 18px; cursor: pointer; } </style> </head> <body>

NodeMCU Car Remote

[removed] var timer; function sendCommand(command) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log("Command sent: " + command); } }; xhttp.open("GET", "http://192.168.4.1/?State=" + command, true); xhttp.send(); } function stopCommand() { clearTimeout(timer); timer = setTimeout(function () { sendCommand("S"); }, 500); } function turnOnLED(ledCommand) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log("LED turned on: " + ledCommand); } }; xhttp.open("GET", "http://192.168.4.1/?State=" + ledCommand, true); xhttp.send(); } function turnOffLED(ledCommand) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log("LED turned off: " + ledCommand); } }; xhttp.open("GET", "http://192.168.4.1/?State=" + ledCommand, true); xhttp.send(); } [removed] </body> </html>