Advertisement
Guest User

LED Webserver

a guest
Aug 26th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.88 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3.   <head>
  4.     <title>LED Controller</title>
  5.    
  6.     <meta name="viewport" content="width=400px" />
  7.    
  8.     <script src="socket.io/socket.io.js"></script>
  9.     <link rel="stylesheet" href="style.css">
  10.    
  11.   </head>
  12.   <body>
  13.     <input type="range" id= "inputSlider" min="0" max="255" value="50" step="1" oninput="showValue(this.value)" />
  14.    
  15.     <br><br><span id="outputText">50</span>
  16.    
  17.     <script type="text/javascript">
  18.         var socket = io.connect();
  19.        
  20.         socket.on('led', function (data) {
  21.             document.getElementById("inputSlider").value = data.value;
  22.             document.getElementById("outputText").innerHTML = data.value;
  23.         });
  24.        
  25.         function showValue(newValue)
  26.         {
  27.             document.getElementById("outputText").innerHTML=newValue;
  28.             socket.emit('led', { value: newValue });
  29.         }
  30.     </script>
  31.   </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement