Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
- </script>
- </head>
- <body>
- <h1>Spark Core Simple Control</h1>
- <p id="myPar">This will switch LEDs on D0 and D1 ON and OFF</p>
- <p>
- <button type="button" onclick="L1ON()">L1 ON</button>
- <button type="button" onclick="L1OFF()">L1 OFF</button>
- <button type="button" onclick="L0ON()">L0 ON</button>
- <button type="button" onclick="L0OFF()">L0 OFF</button>
- </p>
- <script>
- function L1ON()
- {
- $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
- {
- args:"l1,HIGH"
- });
- }
- function L1OFF()
- {
- $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
- {
- args:"l1,LOW"
- });
- }
- function L0ON()
- {
- $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
- {
- args:"l0,HIGH"
- });
- }
- function L0OFF()
- {
- $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
- {
- args:"l0,LOW"
- });
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement