#Control a led remotely using Tornado web server

<div class="text-success lead">
This article illustrates how to control remotely via web a GPIO line using the Tornado web server for Python
</div>

![](./tornado.png)


To follow this article you have to [install Tornado on your Acme Board](/tornado).

The first attempt is to control a led wired on an Acme board.  

The files used are:

* The web server: @pg='python/tornado/led/led.py'
* A simple html page with two buttons: @pg='python/tornado/led/index.html'
* The web site icon: **favico.ico**

Plug a [Daisy-11](/DAISY-11) board to the Daisy connector **D11** then type:

<pre class="minicom">
~/playground/python/tornado/led# <b>python led.py</b>
</pre>

It is possible to use a different GPIO line just changing the line

<pre class="prettyprint">
led = ablib.Daisy11('D11','L1')
</pre> 

Open your browser and try to send the on-off command directly using these urls:

* [http://acme_board_ip_address:8080/ledon](http://acme_board_ip_address:8080/ledon)
* [http://acme_board_ip_address:8080/ledoff](http://acme_board_ip_address:8080/ledoff)

Now open the default web page: 

* [http://acme_board_ip_address:8080](http://acme_board_ip_address:8080)

and turn on-off the led using the two HTML buttons like these:

<fieldset style="width: 220px;">
	<legend>Led control panel</legend>
	<button onclick=sendCmd("/ledon")>ON</button>
	<button onclick=sendCmd("/ledoff")>OFF</button>
</fieldset>

<br/>
<label>Last status message:</label>
<br/>
<span id="state_line"/></span>

## Related links

* @article='tornado_web_server_python'
* [Website Planet favicon editor](https://www.websiteplanet.com/webtools/favicon-generator/) Many thanks to Amelia for this link
* [Favicon.cc on-line favicon editor](http://www.favicon.cc/)

@include='bio_tanzilli'

