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

Sending e-mail with an attachment from BeagleBone Black


Like the OpenCV library to work with images and camera on BeagleBone Black with Python, we have many other wonderful libraries that are developed and are built in Python. One such library is the SMTP e-mail library, which we will be using in this section.

To test this, we will use the image we captured in the project in the previous chapter, available inside the ImageCapture folder.

We will change our working directory to the ImageCapture directory first, as shown in the following screenshot, using cd ImageCapture:

Then, we will go ahead and create a Python file with code to send an e-mail with an attachment in it. To do that, first create a new file named sendemail.py, using sudo nano sendemail.py:

Now, type in the code shown in the following screenshot and save the file inside the ImageCapture folder itself. The code has been written with comments on most of the lines for you to get a clear idea of how it works.

You'll see that the Photo...