O'Reilly logo

Python Programming with Raspberry Pi by Srihari Yamanoor, Sai Yamanoor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the web dashboard

The first step is creating the html template for the dashboard. Our dashboard is going to enable controlling four appliances, that is, turn them on or off:

  1. In our dashboard, we need an htmltable where each row on the table represents a device, as follows:
       <table>            <tr>                <td>                    <input type="checkbox" name="relay"                     value="relay_0">Motor</input> </br>                </td>            <td>                <input type="radio" name="state_0" value="On">On               </input>                    <input type="radio" name="state_0" value="Off"                    checked="checked">Off</input>           </td>        </table>
  1. In the preceding code snippet, each device state is encapsulated in a data cell <td>, each device is represented by a checkbox, and the device state is represented by an on/off radio button. For example, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required