Book Image

BeagleBone By Example

By : Pei JIA, Jayakarthigeyan Prabakar, Alexander Hiam
Book Image

BeagleBone By Example

By: Pei JIA, Jayakarthigeyan Prabakar, Alexander Hiam

Overview of this book

BeagleBone is a low cost, community-supported development platform to develop a variety of electronic projects. This book will introduce you to BeagleBone and get you building fun, cool, and innovative projects with it. Start with the specifications of BeagleBone Black and its operating systems, then get to grips with the GPIOs available in BeagleBone Black. Work through four types of exciting projects: building real-time physical computing systems, home automation, image processing for a security system, and building your own tele-controlled robot and learn the fundamentals of a variety of projects in a single book. By the end of this book, you will be able to write code for BeagleBone in order to operate hardware and impart decision-making capabilities with the help of efficient coding in Python.
Table of Contents (17 chapters)
BeagleBone By Example
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Advanced project: An Internet controlled power switch – controlling an AC bulb from the Internet


Now we have set up the circuit from the previous topic, we will code it on Python to switch the GPIO to HIGH and LOW from the web page. You can proceed and write the code as shown in the following screenshot:

Now save the file as GPIOControlWebApp.py.

Let's run the code to switch the lamp on and off, and go ahead and open the page from the Android tablet. The tablet is connected to the same LAN Wi-Fi router as the BeagleBone board. Click the on and off buttons and you will see the output in the shell terminal as shown in the following screenshot:

And the bulb will turn on and off as shown in the following pictures:

Bulb is in the off state

Bulb is in the on state

But right now, we are just doing this on our local network within our home router LAN network to which the BeagleBone board is connected. What if we wanted to control the bulb via a 3G connection available on our phone? In this case you need...