Book Image

Raspberry Pi Embedded Projects Hotshot

Book Image

Raspberry Pi Embedded Projects Hotshot

Overview of this book

Table of Contents (20 chapters)
Raspberry Pi Mechatronics Projects HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

A customary web server example


Any home automation project using Raspberry Pi yields a lot of examples that involves building a web server that controls appliances within a local network that takes care of securing the place using electromechanical locks. We will build a simple web server that can be used to turn off an LED from a web page. This concept can be expanded to control multiple appliances and read sensor data from the GPIO interface of Raspberry Pi.

Note

This task is meant for absolute beginners who are not familiar with Python web framework tools. We are discussing this example considering some readers might jump right to Project 11, Home Automation Using Raspberry Pi.

Prepare for lift off

We will be building a web server using a Flask framework (http://flask.pocoo.org/). The Flask framework can be installed as follows:

sudo apt-get install python-pip
sudo pip install Flask

Engage thrusters

  1. The first part is setting up the landing page. When a user enters the address of the web server...