Created
December 8, 2020 19:53
-
-
Save cmsunu28/2cf8172ed4d9e11b7f32a1f71f8a6ace to your computer and use it in GitHub Desktop.
imp001 impExplorer agent code: control an LED from the internet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTTP | |
function requestHandler(request,response) { | |
try { | |
server.log(http.jsonencode(request.query)); | |
if ("led" in request.query) { | |
device.send("set.led",request.query.led); | |
} | |
response.send(200,"OK"); | |
} catch (err) { | |
response.send(500,"ERROR: "+err); | |
} | |
} | |
http.onrequest(requestHandler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment