Control a led remotely using Tornado web server

This article illustrates how to control remotely via web a GPIO line using the Tornado web server for Python

To follow this article you have to install Tornado on your Acme Board.

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

The files used are:

  • The web server: led.py
  • A simple html page with two buttons: index.html
  • The web site icon: favico.ico

Plug a Daisy-11 board to the Daisy connector D11 then type:

~/playground/python/tornado/led# python led.py

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

led = ablib.Daisy11('D11','L1')

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

Now open the default web page:

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

Led control panel



Related links