Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
BeagleBone By Example

You're reading from  BeagleBone By Example

Product type Book
Published in Aug 2016
Publisher Packt
ISBN-13 9781785285059
Pages 262 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

BeagleBone By Example
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with BeagleBone 2. Circuit Fundamentals and GPIO 3. Introduction to Physical Computing Systems 4. Real-time Physical Computing Systems Using BeagleBone 5. Connecting Physical Computing Systems to the Internet 6. Home Automation Using BeagleBone 7. Working with Images Using Computer Vision 8. Home Security Systems Using BeagleBone Black 9. Exploring Robotics 10. Building Your Own Robot 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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}