This may be a very simple question for someone out there.
Say I have an int Arduino vairble:
int sensorData = analogRead(sensorPin);
How would I be able to pass that as a JS variable?
client.println("<script> var dat = sensorData </script>"); // this is what I have tried
For more context, I am trying to pass the variable to update a webpage heading; which does work if I pass in a JS variable, but not an Arduino one:
client.println("<h1 id=\"sensorData\"> %SENSORDATA% </h1>");
client.println("document.getElementById(\"sensorData\").innerHTML = dat");
Any help would be greatly appreciated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.