Advertisement
PDP11

Spark Core Web Page Control

Feb 17th, 2014
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
  6. </script>
  7. </head>
  8.  
  9. <body>
  10.  
  11. <h1>Spark Core Simple Control</h1>
  12.  
  13. <p id="myPar">This will switch LEDs on D0 and D1 ON and OFF</p>
  14.  
  15.  
  16. <p>
  17. <button type="button" onclick="L1ON()">L1 ON</button>
  18. <button type="button" onclick="L1OFF()">L1 OFF</button>
  19. <button type="button" onclick="L0ON()">L0 ON</button>
  20. <button type="button" onclick="L0OFF()">L0 OFF</button>
  21. </p>
  22.  
  23. <script>
  24. function L1ON()
  25. {
  26. $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
  27. {
  28. args:"l1,HIGH"
  29.  
  30. });
  31. }
  32.  
  33. function L1OFF()
  34. {
  35. $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
  36. {
  37. args:"l1,LOW"
  38.  
  39. });
  40. }
  41.  
  42. function L0ON()
  43. {
  44. $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
  45. {
  46. args:"l0,HIGH"
  47.  
  48. });
  49. }
  50. function L0OFF()
  51. {
  52. $.post("https://api.spark.io/v1/devices/123456789etc/led?access_token=123456789etc",
  53. {
  54. args:"l0,LOW"
  55.  
  56. });
  57. }
  58.  
  59.  
  60. </script>
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement