1,488 14

Using simple RPC service

Use simple rpc script to call RPC service on small IOT devices
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<html> <head> <script src="simple_rpc_service.js"></script> </head> <body onLoad='startup();'> <h4 id="hostname"> </h4> <p>Hello, see <a target="_blank" href="/rpc/Config.Get">rpc</a> <br><a target="_blank" href="/rpc/clearAll">clear strip</a> <p><table> <tr><td>Pin</td> <td><input type="number" id="" value='2'/></td></tr> <tr><td>Red</td><td><input type="range" id="rval" name="rval" min="0" max="255" value='0' onchange="setPixel()"/></td></tr> <tr><td>Green</td><td><input type="range" id="gval" name="gval" min="0" max="255" value='0' onchange="setPixel()"/></td></tr> <tr><td>Blue</td><td><input type="range" id="bval" name="bval" min="0" max="255" value='0' onchange="setPixel()"/></td></tr> </table> <p><button href="#" id="setPixel" onclick="setPixel()">Set Pixel</button> <button href="#" id="clearAll" onclick="callRPCService('clearAll')">Clear All Pixel</button> <p><button href="#" id="setPixel" onclick="rebootDevice()">Reboot</button> <script> var log = function(msg) { console.log(msg); }; log('Starting ...'); function setPixel() { log("setPixel..."); var pin = parseInt(document.getElementById("").value); var rv = parseInt(document.getElementById("rval").value); var gv = parseInt(document.getElementById("gval").value); var bv = parseInt(document.getElementById("bval").value); callRPCService('setPixel',{px:pin, r:rv, g:gv, b:bv}); }; </script> </body> </html>
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus