Page 124 - Programming the Photon Getting Started With the Internet of Things
P. 124

your functions and circuits to make sure everything works as expected. But to get the best
        experience out of your projects, it would be much nicer to build a user interface using a
        webpage to control the Photon through the Web browser so that when we click a button, it

        will turn an LED on or off as shown in Figure 6.6.

















































        Figure 6.6 LED Web browser interface.


             When  we  register  a  function  variable,  we  are  basically  making  space  for  it  on  the
        Internet, similar to how you make space for a website that you would navigate to using

        your  Web  browser.  We  can  create  a  simple  Hypertext  Markup  Language  (HTML)
        document on your computer with some basic buttons that send commands to the Photon
        board:


        <center>
        <br>
        <br>

        <br>
        <form action="https://api.particle.io/v1/devices/your-device-ID-goes-here/l
        ed?access_token=your-access-token-goes-here" method="POST">

        Tell your device what to do!<br>
        <br>
        <input type="radio" name="args" value="on">Turn the LED on.
   119   120   121   122   123   124   125   126   127   128   129