Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>WebIOPi | Light Control</title>
  6. <script type="text/javascript" src="/webiopi.js"></script>
  7. <script type="text/javascript">
  8. webiopi().ready(function() {
  9. var updateStatus = function(macro, args, response){
  10. var status = response;
  11. $("#inputStatus").val(status);
  12. }
  13. webiopi().callMacro("getDoorStatus", [], updateStatus);
  14.  
  15. // Create a "Light" labeled button for GPIO 24
  16. var button = webiopi().createGPIOButton(24, "Toggle");
  17.  
  18. // Create a refresh status button
  19.  
  20.  
  21.  
  22.  
  23. // Append button to HTML element with ID="controls" using jQuery
  24. $("#controls").append(button);
  25.  
  26. // Refresh GPIO buttons
  27. // pass true to refresh repeatedly of false to refresh once
  28. webiopi().refreshGPIO(true);
  29. });
  30.  
  31. function updateTheBox() {
  32. var updateStatus = function(macro, args, response){
  33. var status = response;
  34. $("#inputStatus").val(status);
  35. }
  36. setTimeout(updateTheBox,1000);
  37. webiopi().callMacro("getDoorStatus", [], updateStatus);
  38.  
  39. }
  40. updateTheBox();
  41. </script>
  42. <style type="text/css">
  43. button {
  44. display: block;
  45. margin: 5px 5px 5px 5px;
  46. width: 160px;
  47. height: 45px;
  48. font-size: 24pt;
  49. font-weight: bold;
  50. color: white;
  51. }
  52.  
  53. #gpio24.LOW {
  54. background-color: Black;
  55. }
  56.  
  57. #gpio24.HIGH {
  58. background-color: Blue;
  59. }
  60.  
  61.  
  62.  
  63. input.refresh {
  64. display: block;
  65. margin: 5px 5px 5px 5px;
  66. width: 160px;
  67. height: 45px;
  68. font-size: 24pt;
  69. font-weight: bold;
  70. color: white;
  71. background-color: Black;
  72. text-align: center;
  73. }
  74.  
  75. input {
  76. display: block;
  77. margin: 5px 5px 5px 5px;
  78. width: 160px;
  79. height: 45px;
  80. font-size: 24pt;
  81. font-weight: bold;
  82. color: white;
  83. background-color: Green;
  84. text-align: center;
  85. }
  86. </style>
  87. </head>
  88. <body>
  89. <div id="controls" align="center">
  90.  
  91.  
  92.  
  93. </div>
  94.  
  95. <div id="controls" align="center">
  96.  
  97. Door Status: <input type="text" id="inputStatus"/><br/><br/>
  98. <!-- <input class="refresh" type="button" value="Refresh" onclick="updateTheBox()"> -->
  99.  
  100.  
  101. </div>
  102. </body>
  103. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement