Hello i was wondering if their is a way to send info to the web server. What im trying to do is have the pico somewhere else and be collecting the how bright the light is, but how to you send the info to the webpage.
I know how to get info from the webpage though this code
------------Code---------------
function pageHandler(req, res) {
if (req.method=="POST") {
// If it POST(Web side does this), save the data
var info = url.parse(req.url,true);
console.log("POST ",info);
//Looks though HTML "pos" and collect the value
if (info.query && "pos" in info.query)
//Activats setPos
setPos(parseFloat(info.query.pos));
res.writeHead(200);
res.end("Ok.");
} else {
// otherwise write the page out
console.log("GET "+req.url);
if (req.url=="/") {
res.writeHead(200);
res.end(page);
} else {
res.writeHead(404);
res.end("404: Not found");
}
}
}
--------------------------------------end of code----------
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hello i was wondering if their is a way to send info to the web server. What im trying to do is have the pico somewhere else and be collecting the how bright the light is, but how to you send the info to the webpage.
I know how to get info from the webpage though this code