Raspberry Pi By Example 1st Edition Pajankar - Own the complete ebook with all chapters in PDF format
Raspberry Pi By Example 1st Edition Pajankar - Own the complete ebook with all chapters in PDF format
https://ebookultra.com/download/raspberry-pi-networking-cookbook-
golden/
https://ebookultra.com/download/raspberry-pi-media-center-1st-edition-
sam-nazarko/
https://ebookultra.com/download/raspberry-pi-the-complete-manual-7th-
edition-coll/
https://ebookultra.com/download/raspberry-pi-hardware-projects-1-1st-
edition-andrew-robinson/
Raspberry Pi Projects For Dummies 1st Edition Mike Cook
https://ebookultra.com/download/raspberry-pi-projects-for-dummies-1st-
edition-mike-cook/
https://ebookultra.com/download/penetration-testing-with-raspberry-pi-
second-edition-michael-mcphee/
https://ebookultra.com/download/raspberry-pi-home-automation-with-
arduino-1st-edition-k-dennis/
https://ebookultra.com/download/raspberry-pi-a-quick-start-guide-1st-
edition-maik-schmidt/
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express or
implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for
any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.
Livery Place
35 Livery Street
ISBN 978-1-78528-506-6
www.packtpub.com
Credits
Authors
Ashwin Pajankar
Arush Kakkar
Reviewers
Nathan Johnson
Elliot Kermit-Canfield
Anna Torlen
Commissioning Editor
Dipika Gaonkar
Acquisition Editor
Ashwin Nair
Merwyn D'souza
Technical Editors
Nirant Carvalho
Mohit Hassija
Copy Editors
Stuti Srivastava
Madhusudan Uchil
Project Coordinator
Nikhil Nair
Proofreader
Safis Editing
Indexer
Priya Sane
Graphics
Kirk D'Penha
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade
About the Authors
Ashwin Pajankar is a software professional and IoT enthusiast with more than 5 years' experience in
software design, development, testing, and automation.
He graduated from IIIT Hyderabad, earning an M.Tech in computer science and engineering. He holds
multiple professional certifications from Oracle, IBM, Teradata, and ISTQB in development, databases,
and testing. He has won several awards in college through outreach initiatives, at work for technical
achievements, and community service through corporate social responsibility programs.
He was introduced to Raspberry Pi while organizing a hackathon at his workplace, and he's been hooked
on Pi ever since. He writes plenty of code in C, Bash, Python, and Java on his cluster of Pis. He's already
authored one book on Raspberry Pi and reviewed three other titles related to Python for Packt Publishing.
I would like to thank my wife, Kavitha, for motivating me to write this book and share my knowledge with
others. I would like to thank my coauthor, Arush Kakkar, for taking over the project after the first few
chapters. I also thank Merwyn D'Souza from Packt Publishing for providing me with the opportunity,
guidance, and required support in writing this book. Last but not least, I would like to thank all the
reviewers who helped me make the book better by providing their precious feedback.
Arush Kakkar is a computer vision and deep learning researcher and an undergraduate at Delhi
Technological University. His primary focus is on autonomous robotics, which includes drones and self-
driving cars, and he has been involved in building such systems in different capacities, such as navigation,
localization, path planning. He has also leveraged state-of-the art computer vision and deep learning
technologies for them. He is the electrical systems head of the Solar Car team of his university, Solaris
DTU.
He is currently working on his own driverless car company, CruiseX, which uses deep learning to drive
more smoothly and with fewer errors.
You can connect with him through his website at http://www.arushkakkar.com and read up on some of his
projects at http://blog.arushkakkar.com.
I would like to thank my parents for supporting me in writing this book. I would like to thank Ashwin for
collaborating while writing this book, and I would also like to thank Merwyn from Packt Publishing for
coordinating the collaboration. I am thankful to all the reviewers for helping me improve the book and
expanding my knowledge.
About the Reviewers
Nathan Johnson is an NC State University graduate and the author and maintainer of the node-arm
project. Apart from node-arm, he has also contributed to several other Raspberry Pi projects. He
currently works for the Charlotte-based company Red Ventures as a software engineer writing
applications in Node.js.
I would like to thank my mom, dad, and brother for reminding me to use all the talents I've been given.
Elliot Kermit-Canfield is a graduate student studying computer music at the Center for Computer
Research in Music and Acoustics at Stanford University. In addition to a degree in music, science, and
technology from Stanford, he holds degrees in integrative arts and music theory from Penn State. Elliot is
an avid computer musician and has worked with Raspberry Pi and other embeddable systems with audio
applications.
Anna Torlen is an artist, educator, and techie. She received a bachelor of arts degree in studio art at The
College of Santa Fe and a master of fine arts degree in media, technology, and entertainment at Florida
Atlantic University. She has worked on Raspberry Pi projects at her college and at Hacklab in Boynton
Beach, FL. She has contributed to the Adafruit Community Corner blog. She is currently working at Palm
Beach State College as a multimedia adjunct professor. She is interested in building outdoor solar-
powered Internet of Things Raspberry Pi projects.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files
available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer,
you are entitled to a discount on the eBook copy. Get in touch with us at
<[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of
free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here,
you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Preface
Raspberry Pi is probably one of the most versatile computers ever built. It has been adapted for tasks
ranging from home automation, cluster computing, computer vision, and even space missions! What's
more is that it enjoys a level of support from the community that is hard to find for any other platform.
Due to this, it is a hacker-friendly device and is a must for anyone who wants to build projects with even
a little amount of programming involved. The fact that the basic version of the board costs only $25 means
there's a lot of room for experimentation, and users aren't afraid to experiment with and damage it.
In this book, you will find a wide variety of projects, using which anyone can get started with and also
build interesting hacks by modifying some of the projects.
What this book covers
Chapter 1, Introduction to Raspberry Pi and Python, provides an introduction to the Raspberry Pi and
booting it up.
Chapter 2, Minecraft Pi, introduces you to Minecraft Pi, which is a preinstalled version of the popular
game Minecraft. The first few pages of the chapter deal with the game concept and interface, and further
pages deal with programming in-game actions with Python. In the last part of this chapter, you are
introduced to the PyGame library and small usage examples of it.
Chapter 3, Building Games with PyGame, is an introduction to the PyGame programming library and
game programming. In this chapter, you code your way to your first full-fledged program on the Raspberry
Pi, a game.
Chapter 4, Working with a Webcam and Pi Camera, introduces you to the Pi Camera and regular
webcams and how to use them to create real-life applications with the Raspberry Pi. You also create a
time-lapse box project in this chapter.
Chapter 5, Introduction to GPIO Programming, introduces you to the Raspberry Pi B+ and Pi 2 GPIO
structure and its real-life usage with LED programming and a third-party add-on, PiGlow.
Chapter 6, Creating Animated Movie with Raspberry Pi, demonstrates the GPIO and camera together by
creating a project that requires application of both the concepts in order.
Chapter 7, Introduction to Computer Vision, introduces you to computer vision and image processing
with Raspberry Pi. You will create a simple project.
Chapter 8, Creating Your Own Motion Detection and Tracking System, introduces you to advanced
concepts in OpenCV, which will be used to implement the next project, which has a higher difficulty
level.
Chapter 9, Grove Sensors and the Raspberry Pi, introduces you to the Grove shield and Grove sensors
and their interfacing with Raspberry Pi. Grove Sensors are third-party sensors for Raspberry Pi and
Arduino that can be used for environment sensing.
Chapter 10, Internet of Things with the Raspberry Pi, looks at creating home automation and Internet of
Things applications with the Raspberry Pi.
Chapter 11, Build Your Own Supercomputer with the Raspberry Pi, deals with making clusters of
Raspberry Pi 2s, using MPICH2 and MPI for Python to write parallel programs for the clusters, and
running N-body simulation.
Chapter 12, Advanced Networking with the Raspberry Pi, shows you how to improve your cluster of Pis
by adding advanced networking capabilities such as DNS and DHCP. We use of existing cluster for this
and make it better.
Chapter 13, Setting Up a Web Server on the Raspberry Pi, delves into installing PHP, MySQL, and
WordPress on our Raspberry Pi to use it as a web server.
Chapter 14, Network Programming in Python with the Pi, teaches you how to use Python to learn the
basics of network programming and also create network utilities such as Telnet and chat applications on
the Raspberry Pi.
Appendix, Newer Raspberry Pi Models, briefly introduces you to some of the newest members of the
Raspberry Pi family, namely the Raspberry Pi Zero and the Raspberry Pi 3.
What you need for this book
The following hardware is recommended for successfully completing the projects outlined in this book:
Raspberry Pi Model B, B+ or 2 (Multiple boards for last two chapters)
USB hub, powered preferably
Networking hub
PC for preparing SD card
Webcam and/or Pi Camera
Who this book is for
What's the best way to learn how to use your Raspberry Pi? By example! If you want something exciting
to do whilst getting to grips with what your Pi can offer, this is the book for you. With both simple and
complex projects, you'll create a wide variety of cool toys and functions with your Raspberry Pi - all with
minimal coding experience necessary. You can be a beginner before starting with this book, but by the
time you finish it, you will be a Jedi with the Raspberry Pi.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information.
Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy
URLs, user input, and Twitter handles are shown as follows: " We need the random library for the
randint() function, which returns a random integer in the provided range."
New terms and important words are shown in bold. Words that you see on the screen, for example, in
menus or dialog boxes, appear in the text like this: " Check out the Product page of Raspberry Pi at
http://www.raspberrypi.org/products/.."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you
liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get
the most out of.
To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in
the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a
book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most
from your purchase.
Downloading the example code
You can download the example code files for this book from your account at http://www.packtpub.com. If
you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have
the files e-mailed directly to you.
You can also download the code files by clicking on the Code Files button on the book's webpage at the
Packt Publishing website. This page can be accessed by entering the book's name in the Search box.
Please note that you need to be logged in to your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version
of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book.
The color images will help you better understand the changes in the output. You can download this file
from https://www.packtpub.com/sites/default/files/downloads/RaspberryPiByExample_ColorImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find
a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you
could report this to us. By doing so, you can save other readers from frustration and help us improve
subsequent versions of this book. If you find any errata, please report them by visiting
http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your submission will be
accepted and the errata will be uploaded to our website or added to any list of existing errata under the
Errata section of that title.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at <[email protected]>,
and we will do our best to address the problem.
Chapter 1. Introduction to Raspberry Pi and
Python
One can learn about topics in computer science in an easy way with the Raspberry Pi and Python. The
Raspberry Pi family of single-board computers uses Python as the preferred development language. Using
Raspberry Pi and Python to learn programming and computer science-related concepts is one of the best
ways to start your journey in this amazing world of computers that is full of creative possibilities. We will
explore these possibilities in this book.
We will commence our journey in this chapter by getting ourselves familiar with the following topics:
Single-board computers
Raspberry Pi
Raspbian
Setting up Raspberry Pi
Basics of Python
Turtle programming with Python
Single-board computers
A single-board computer system is a complete computer on a single circuit board. The board includes a
processor(s), RAM, input/output (I/O), and networking ports for interfacing devices. Unlike traditional
computer systems, a single-board computer is not modular and its hardware cannot be upgraded as it is
integrated on the board itself. Single-board computers are used as low-cost computers in academia,
research, and embedded systems. The use of single-board computers in embedded systems is quite
prevalent and many individuals and organizations have developed and released fully functional products
based on single-board computers.
The Microcomputer Trainer MMD-1 designed by John Titus in 1976 is the first true single-board
microcomputer that was based on the Intel C8080A. It was called dyna -micro in the prototyping phase,
and the production units were called MMD-1 (short for Mini Micro Designer 1).
Popular single-board computers available in the market include but are not limited to Raspberry Pi,
Banana Pro, BeagleBone Black, and Cubieboard. The following images are of the front view of
BeagleBone Black, Banana Pro, and Cubieboard 4, respectively:
Raspberry Pi
The Raspberry Pi is a series of low-cost, palm-sized single-board computers developed by Raspberry Pi
Foundation in the UK. The intention behind the creation of the Raspberry Pi is to promote the teaching of
basic computer skills in schools, which it serves very well. Raspberry Pi has expanded its footprint well
beyond its intended purpose by penetrating the embedded systems market and computer science research.
Note
This is the home page of Raspberry Pi Foundation: http://www.raspberrypi.org.
The Raspberry Pi is manufactured with licensed agreements with Newark element14, RS Components,
Allied Electronics, and Egoman. These companies manufacture and sell the Raspberry Pi. The hardware
is the same across all manufacturers.
The following table displays the URLs of the manufacturers' websites, where you can shop for Pi and
related items online:
Manufacturer Website
RS Components http://uk.rs-online.com
Egoman http://www.egoman.com.cn
You can also shop for Pi and the other third-party add-ons at the following links:
http://shop.pimoroni.com
http://www.adafruit.com
Raspberry Pi models
The following are, at the time of writing this, the major models of Raspberry Pi:
Model A (not in production; discontinued in favor of the production of later and upgraded models)
Model A+ (currently in production and available for purchase)
Model B (available for purchase but not in production)
Model B+ (currently in production and available for purchase)
Raspberry Pi 2 Model B (currently in production and available for purchase)
Note
Check out the Product page of Raspberry Pi at http://www.raspberrypi.org/products/.
Additionally, Raspberry Pi is also available in a more flexible form factor intended for industrial and
embedded applications. It is known as Compute Module. A Compute Module prototyping kit is also
made available by the foundation.
Note
Check out the following URLs for the Compute Module and Compute Module development kit,
respectively:
http://www.raspberrypi.org/products/compute-module/
http://www.raspberrypi.org/products/compute-module-development-kit/
The following image shows the top view of the flip side of Raspberry Pi Model B+:
The following image shows the top view of the Raspberry Pi 2 Model B front. The location of the
connectors and important ICs (integrated circuits) on the board is not different from Pi B+:
We will be using Raspberry Pi 2 Model B throughout this book. However, all the applications and
programs in this book will work on all the models of Pi.
Operating systems
The Raspberry Pi primarily uses Unix-like Linux-kernel-based operating systems, such as variants of
Debian and Fedora.
Raspberry Pi Models A, A+, B, and B+ are based on the ARM11 family chip, which runs on the ARMv6
instruction set. The ARMv6 instruction set does not support Ubuntu and Windows.
However, the recently launched Raspberry Pi 2 is based on ARM Cortex A7, which is capable of running
Windows 10 and Ubuntu (Snappy Core). The following operating systems are officially supported by all
the models of Raspberry Pi and are available for download at the download page:
Raspbian: We will be using this with Raspberry Pi throughout the book
OpenELEC
Pidora (Fedora Remix)
RASPBMC
RISC OS
Note
Windows 10 and Ubuntu are only supported by the recently launched Pi 2.
Raspbian
Raspbian is an unofficial variant of Debian armhf (ARM Hard Float) compiled for hard float code that
will run on Raspberry Pi computers. It is a free operating system based on Debian optimized for the
Raspberry Pi hardware.
Note
To know more about Raspbian, visit http://www.raspbian.org/.
Setting up the Raspberry Pi
We need the following hardware to set up a Pi.
Raspberry Pi 2 Model B (hereafter, this will be referred only as Pi).
Power Supply: A micro USB power supply.
Considering that we are going for slightly power-intensive usage of our Pi (such as connecting Pi
Camera, webcam, and third-party sensors for Pi), a 5V 2A power supply is recommended. The
micro USB pin is shown in the following image:
Note
You can find a similar one online at http://www.adafruit.com/product/1995.
A standard USB keyboard
A MicroSD card and a MicroSD to SD card converter
If you are using HDMI monitor, then an HDMI cable will be sufficient. If you are using a VGA
monitor, then you need to use an HDMI to VGA converter with a VGA cable. Some special changes
need to be made to the /boot/config.txt file if you're using a VGA monitor, which will be
explained in the next section.
Note
You can find a similar one online at https://www.adafruit.com/products/1151.
A Windows, Linux, or Mac OS computer with a MicroSD card reader and an Internet connection
Preparing MicroSD card manually
This is the original way to install an OS into a MicroSD card, and many users, including me, still prefer
it. It allows the SD card to be prepared manually before it is used and it allows easier access to
configuration files such as /boot/config.txt, which we might have to modify in a few cases before
booting up. The default Raspbian image consists of only two partitions, BOOT and SYSTEM, which will fit
into a 2 GB card. However, I recommend that you use a minimum 4 GB card to be on safe side. Choosing
an 8 GB card will be adequate for most of the applications we are going to develop in this book.
You might receive the following message if the card reader's write protection is on:
7. Toggle the write protection notch and try again. You will see the following message:
8. Click on Yes and it will start writing the image file to the microSD card:
9. Once the image is successfully written, it will display the following message:
Note
If you are using Linux, then you can find the instructions at
https://www.raspberrypi.org/documentation/installation/installing-images/linux.md.
If you are using Mac OS, then you can find the instructions at
https://www.raspberrypi.org/documentation/installation/installing-images/mac.md.
If you have an HDMI monitor, then skip this step. This additional step is required only if you are planning
to use a VGA monitor in place of an HDMI monitor.
Browse the microSD card on the computer. Locate and open config.txt. We have to edit the file in
order to enable proper display on the VGA monitor.
By default, the commented options (which have # at the beginning) are disabled. We are enabling this
option by uncommenting this line, that is, by removing # from the beginning of the commented line. This is
what you need to do:
1. Change #disable_overscan=1 to disable_overscan=1.
2. Change #hdmi_force_hotplug=1 to hdmi_force_hotplug=1.
3. Change #hdmi_group=1 to hdmi_group=2.
4. Change #hdmi_mode=1 to hdmi_mode=16.
5. Change #hdmi_drive=2 to hdmi_drive=2.
6. Change #config_hdmi_boost=4 to config_hdmi_boost=4.
7. Save the file.
Another Random Scribd Document
with Unrelated Content
– Jó, de hátha többen lennének, én is elmegyek kegyelmeddel,
hogy segélyére lehessek.
– Igen, de az is meglehet, folytatá Gergely tompa hangon,
mintha nem akarná, hogy hallják a mit mond, hogy a kit ott kapok,
nem pénzemet, hanem becsületemet jött elrabolni, s akkor jobb, ha
rajtam kívül más nem tudja. Azt elhiheti kend, hogy leányomat meg
nem ölöm, egyért azért, mert asszonyt ölni nem szokásom, más meg
az, hogy szeretem, ha szégyenemre válik is; de ha férfit kapok ottan,
akkor!… akkor esküszöm a szent háromság egy Istenre, Gernyeszegi
Menyhért uram, hogy ha hétszáz pap imádkozik is érte, és hétezer
ördög őrzi is, minden haja szálát kétfelé hasítom!
Ezt mondva a jó úr, félre tolta az útból a becsületes lelkészt, s a
nehéz tölgyfaajtót olyan dühvel vágta be maga után, hogy minden
asztal tánczolt bele.
– Igyunk tovább nagytiszteletű uram, szólt Bethlen Miklós uram,
ki az egész jelenet alatt meg sem mozdult a helyéről, majd elvégzi
azt Gergely bátya, s ha szüksége lesz ránk, meghalljuk. Isten éltesse
ifju Apafi Mihály uramat, a fejedelmet!
A pap ivott a kimondott egészségért, a két úr keserűen
mosolygott egymás szeme közé.
***
Az éji lovagok ezalatt kikerülve az előttük haladó szánt, mély
hófuvatos árkokon s zuzmarás berkeken keresztül elvergődtek
Küküllővár alá. A vár déloldali ablaka ki volt világítva a délkeleti
torony ablakában két gyertya égett.
– Künn a jel! szólt András gazda urához.
– Szálljunk le lovainkról, monda az ifju könnyedén leszökve
paripájáról, s a kantár szárát szolgájának vetve. Te keresd föl a
legközelebbi csapszéket. Ott melegedj föl. Egy óra múlva ismét itt
légy.
Az ifju lovag azzal a torony felé sietett. A várárok be volt fagyva,
könnyen átmehetett rajta, ott egy palánkon kellett magát
keresztülvetnie, s nehány pillanat mulva a toronyajtó előtt állt,
miután annak kőlépcsői szét voltak hányva, a kiálló kőpárkányokon
kapaszkodva föl annak erkélyeig.
A távolból a szán csörgése hallatszott.
– Hozta Isten ifju uram! szólt egy suttogó hang a belopózóhoz, s
egy izmos némber, kiben Magdusra ismerünk, kézenfogva a lovagot,
fölvezette őt azon szobáig, melyben a két gyertya égett.
A szobában vígan pattogó kandallótűz vete élénk világot,
kitüntetve azt a sok apró, kedves, semmi haszonra nem levő tárgyat,
mikkel hölgyek fel szokták szobáikat ékesgetni, s mi azoknak olyan
jól illik.
– Jaj lovag úr, kezdé Magdus, már csak vegye el kisasszonyunkat,
mert még a templomban sincs bátorságban kegyelmed nélkül.
– Jót mondasz, jó Magdus, felelt a lovag mosolyogva, hanem
kettőn áll a vásár.
– De lovag úr, a hol az eladó is oly kész mint a vevő, hamar
készen van ott az alku.
A lovag jó kedvében egy aranyat nyomott a cseléd markába, az
bosszúsan adta vissza.
– Mit gondol kegyelmed? nekem egy aranyat? kegyelmed
szegény ember, nem így kell vesztegetni a pénzt. Kelleni fog bizony
menyegzőre, akkor is csak márjást a cselédnek, nem aranyat.
– Úgy, igaz, dörmögé magában a lovag, hisz én szegény vagyok.
E perczben fordult a kilincs, a lovag oda szökött az ajtóhoz s
felrántva azt, Ilonkát látta maga előtt örömtől és boldogságtól
üdvezült arczczal.
A két szerelmes napok óta tanulgatá magában a szavakat, miket
e találkozáson egymásnak mondani fog; épen azért egy szó sem jött
ajkaikra, némán megölelték egymást, egy csók volt mind az, a mit
egymásnak mondani tudtak.
– Haragom van rád, szólt Ilonka, ki akarva fejleni Mihály
karjaiból, – tudta, hogy nem fogja bocsátani, – te úgy jösz hozzám,
mint a tolvaj, az ablakon keresztül, mikor az ajtó is nyitva áll előtted,
titokban, midőn nyiltan is jöhetnél.
– Nem jöhetnék Ilonka. Atyád bizonyosan megtiltaná.
– Lásd, szólt Ilonka mondhatlan hamiskás mosolygással, én
bátrabb vagyok tenálad. Te nem merted kezemet megkérni
atyámtól; én megtettem helyetted és nem kaptam tagadó választ.
A lovag egyszerre elkomorult.
– Te elmondál neki mindent?
– Találkozásunkat. A többit ő maga kitalálta; én mondám neki,
hogy te szegény vagy, ő felkaczagott, megveregette arczomat,
megcsókolt és azt mondta, hogy Kendefi is szegény, mégis neki adta
nénémet.
– Lásd azt nagyon rosszul tevéd, hogy titkunkat előtte
felfedezted. A mit mondok, nem fogod érteni, de hinni fogod, hogy
igaz. Sem atyád, sem rokonaid nem fognak tégedet nekem nőül
adni, ha engem megismernek; okaik vannak rá, mikről sem ők nem
tehetnek, sem én.
– Nem értem, mi okaik lehetnek? Hogy szegény vagy, azt tudják
már, ha családjaink ellenségek, én kibékítlek benneteket, ha más
hiten vagy, majd megtérítlek én. Oh az én családom nem terem oly
képtelen embereket, mint te gondolod. A Bethlenek jó szive
mindenütt ismeretes, családi körünkben s az ország ügyeiben
egyaránt.
– Jól tudom. De van egy körülmény, melyet te nem ismersz, s
mely korlátot emel szerelmem és szíved között. A Bethlenek az
utolsó férfiig ellenezni fogják, hogy férjed lehessek, míg ha már az
volnék, örömmel szorítanának karjaik közé.
– Nem értelek. Nem értelek.
– Ne is érts, csak higyj. Boldogságunk egyedül attól függ, hogy
tudsz-e bennem eléggé bizni s tenni azt, a mire kérlek? A
legközelebbi faluban értekeztem a lelkészszel, ki bennünket azon
perczben összeadand, melyben előtte megjelenünk. Akarsz-e velem
jőni?
– Én szökve, atyám tudta nélkül?
– De velem. Az én lovagbecsületem védpaizsa alatt. Esküdni nem
szokásom, de szavamra mondom, hogy míg nőmmé leendsz,
megőrzelek, s ha az lettél, megszerzem számodra mindenki
becsülését és atyád áldását.
Ilonka tétovázni, ingadozni kezdett. E pillanatban erőszakosan
felszakasztaték az oldalajtó s a szerelmesek előtt Bethlen Gergely
uram állott, meztelen karddal kezében.
Ilonka nagyot sikoltva veté magát apja keblére s onnan lassan
alácsúszva, annak lábaihoz omlott.
Bethlen Gergely sok szóba kezdett, míg egyet ki tudott mondani.
A lovag háttal állt a kandallónak s félkezével eltakarta arczát.
– Suhancz! ordíta rá Gergely, kardja reszketett izmos kezében.
Látom a te oldalodon is kard van. Húzd ki ilyen amolyan lélek fia,
mert négy felé váglak.
A lovag erre levette kezét arczáról s azt a tűz felé fordítva,
méltóságteljes tekintettel nézett Bethlen szemeibe.
Az öreg e pillanatra egyszerre átváltozott. A düh és meglepetés
egy pillanatig küzdöttek arczán, egészen elkomorult, szemeit
lesütötte, kardját a falnak támasztá s hüvelykujját övébe dugva,
nagyokat mordult: Üm – igen – hm. – Azután mérgesen fordult
Magdus felé: Vidd kisasszonyodat szobájába.
Ilonka még jobban megrettenve atyja elkomorulásától, mint
előbbi haragjától, átkarolta annak térdeit s reszketve könyörgött
neki:
– Hiszen te azt mondád, hogy nem fogsz arra haragudni, a kit
szeretek, bárha szegény is.
– Szegény? szólt az öreg úr metsző sarcasticus hangon. Az igaz,
hogy elég szegény, nincs egyebe ennél a kis Erdélyországnál. Ő
nagysága Apafi Mihály uram, a fejedelem.
– Igen, az vagyok, szólt az ifju előlépve, s ha úgy akarod,
leányod férje, kit fogadom, hogy boldoggá fogok tenni.
– Oh atyám! szólt Ilonka örömrepesve csókolva atyja kezét.
– Menj szobádba, viszonzá Gergely szigorú hangon. Itt nem rólad
van szó többé, hanem Erdélyországról, s azzal karon fogva leányát,
kivezette a teremből s azzal magukra zárta az ajtót.
– Nagyságos uram, szólt Gergely visszatérve a fejedelemhez,
sokat szeretnék kegyelmednek mondani, ha czudarság nem volna a
magam házánál összeszidni a vendéget, bárha az ablakon jött is be!
hanem annyit mégis megmondok kegyelmednek, hogy inkább
hagyta volna kegyelmed leányomat összetépni a medvétől, mint
hogy maga tépte össze. Mert hogy kegyelmed az én leányomat
elvenni nem fogja, arra már aztán esküszöm.
– Mi kifogásod van ellenem?
– Ne méltóztassék tréfálni ez órában, nagyságos uram. Én vén
ember vagyok, az eszem sem szállt még a lábam szárába. Vajmi jól
tudja azt kegyelmed, hogy a kegyelmed fejedelemsége leendő
házasságától függ. Nehány hónap mulva letelt a kegyelmed
kiskoruságának ideje, s a számára kijelölt mátka, a Brandenburgi
Márkio leánya azóta szintén felnőtt. Boldog lesz-e kegyelmed általa?
az nem kérdés, de fejedelemmé lesz. Ha pedig egy ilyen
magamforma nemes ember leányát veszi el kegyelmed, engemugyse
az ágy alá vágta akkor kegyelmed a fejedelemsüveget.
– Mit bánom én.
– De bánom én és bánja az ország! Kegyelmed csak egy ember,
én is csak egy vagyok, mi élhetünk, halhatunk, a hogy Istennek
tetszik, de most Erdély jövendőjéről van szó, s mi nem fogjuk tűrni,
hogy a kegyelmed szerelmessége miatt elveszszen az ország. Ha
kegyelmed most elveszti a fejedelemséget, soha sem lesz itt többet
úr a magyar. Menjen innen kegyelmed Isten szent hírével s teljesítse
azt, a mit az ország rendei határoztak. Ilonka kegyelmed neje nem
leend. Leányom szive megszakadhat, az enyém vele szakadhat meg,
de kegyelmed még sem fogja őt birni, mert Erdélyország sorsa
előbbvaló. Kegyelmed meggyalázta házamat; – ellenségeim meg
fogják tudni; – leányom hírneve oda lesz; de azért kegyelmed nem
fogja őt nőül venni, mert Erdélyország sorsa több, mint az én
becsületem… Kegyelmed apja sok jó magyar nemest lenyakaztatott,
kegyelmed örökölte apja nevét, öröklendi apja vérszomját is; én
tudom, hogy magam leszek az első, kinek fejét kegyelmed, ha
fejedelemmé lesz, leütteti és azért mégis kényszeríteni fogom
kegyelmedet, hogy fejedelme legyen Erdélynek, mert az én fejem
semmi ott, hol Erdélyország sorsáról van a szó. Most Isten áldja meg
nagyságodat.
Ezt mondva Gergely úr, fejébe rántotta elülről hátulról kis veres
sipkáját, s keserű elkomorodással fordult el az ifju fejedelemtől, ki
némán, leverten, összefont karokkal bámult a kandalló hamvadó
tüzébe, s egy szót sem birt viszonozni az ősz honfi feddő szavaira.
– Még egyet uram, szólt Gergely visszafordulva az ajtóban. A mit
mondtam, mind komoly, megmásolhatlan szó volt s én rajta leszek,
hogy szavamat megtartsam; azért ha kegyelmed mint igaz nemes
ember azt nem akarja, hogy leányomat ezentúl elzárva tartsam mint
egy apáczát, lovagi kötelességének ismerje hozzá többet soha nem
közelíteni.
A fejedelem szomorúan távozott el a toronyból. Gergely magához
vette az ajtók kulcsát s visszatért vendégeihez.
– Csak igyanak kendtek, semmi baj sem volt, semmi, szólt
közéjök lépve, jó kedvet erőltetve arczára, hogy szinte csikorgott
bele minden vonása. Egy kis izé – aztán semmi egyéb; bolond tréfa,
majd halálra nevettem magamat. Haha! Egy csatlósom furcsán járt
Magdussal, hahaha az ördögbe.
Hanem e nevetés közben úgy megszorítá az ezüst kupát, melyet
kezébe fogott, hogy a két oldala összehorpadt s a bor kiömlött
belőle. A vér elfutotta szemeit.
– Ejh, milliom istennyila! kiálta falhoz vágva a serleget, nem
megy már nekem a tettetés, hisz leolvashatják kendtek az arczomról,
akármit beszélek, hogy meg vagyok gyalázva.
– Mit? mi történt? kérdezék a vendégek.
– Hát egy suhancz, valami siheder, még leányommal barátságot
mert kötni, beszélt Gergely úr, ellobbant haragja után ismét
magához térve, hogy új mesét mondjon vendégeinek. De kiadtam a
ficzkónak az útat, jól járt, hogy ott nem vetettem le, a hol feljött, az
ablakon.
– De hát inkább kényszeríteni kellett volna, szólt közbe a pap,
hogy ha hírbe hozta a leányt, tegye nejévé.
– Majd én egy sehonnainak adom a leányomat, egy koldusnak,
szólt tettetett pattogással Gergely úr, soha bizony.
– Hisz az elébb egészen máskép beszélt kegyelmed ezen a
helyen, feddőzék a pap, igen okosan mondá, hogy nem tekint
vagyonra, születésre, csak leánya szeresse a kit választott.
Gergely úr feje főtt a lelkész beszéde alatt, szemei karikát
hánytak, szerencsére a serleget már eldobta, mert különben baj lett
volna; még beszélt volna a lelkész, de Gergely úr egyszerre olyat
csapott öklével az asztalra, mint a menydörgő mennykő, s felordított,
a hogy kifért a torkán:
– Az akkor volt! Én tudom mit beszélek! Hagyjon kend nekem
békét.
Erre fölkelt Bethlen Miklós s Gergely urat átölelve, visszaülteté
székére, fülébe súgva:
– Legyen kegyelmed nyugodt, mi mindent tudunk, a látogató a
fejedelem volt.
Gergely úr lankadtan esett székébe vissza, mint ki álomból
ébredett föl.
– De kiadtam neki az útat, dörmögé az őt értőknek.
– Kegyelmed igaz hazafi, szólt Bánfi, megrázva a kezét az
öregnek.
– Ezt nem hagyjuk megtörténni soha, mondá szilárdul Bethlen
Miklós, s a három férfi könyes szemekkel nézett össze, míg a pap
sehogy sem tudta magának kimagyarázni, hogy micsoda nagy
hazafiuság lehet abban, ha az ember nem adja a leányát annak, a
kit szeret?
A TATÁROK.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com