2018-10-07

Die Webseite zum Esp8266 OnBoardLed.

onboardled.html

<!-- For more information visit: https://fipsok.de -->
<!DOCTYPE html>
<html lang="de">
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link rel="stylesheet" href="style.css">
      <title>Onboard Led</title>
      <script>
         window.addEventListener('load', function () {
           elem = document.querySelector('#led');
           elem.addEventListener('click', once.bind(this, '?zap='));
         }, once(''));
         function once(arg) {
           fetch('bled' + arg).then(function (response) {
             return response.text();
           }).then(function (text) {
             elem.innerHTML = 'LED ' + text;
             elem.style.backgroundColor = text == 'Ein' ? '#adff2f' : 'red';
           });
         }
      </script>
   </head>
   <body>
      <h2>Onboard Led schalten</h2>
      <h2>Esp8266 Nodemcu Wemos</h2>
      <button id="led"></button>
   </body>
</html>

Zurück