Book Image

Learning Raspberry Pi

By : Samarth Shah, Serge Schneider
Book Image

Learning Raspberry Pi

By: Samarth Shah, Serge Schneider

Overview of this book

Table of Contents (14 chapters)
Learning Raspberry Pi
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Developing an alarm clock


After developing two projects, you must be confident working with Raspberry Pi GPIO, LED and LCD. In this section, apart from a little bit of more coding, you will be using one or more pieces of hardware, which is a speaker with Raspberry Pi. You will develop an alarm clock that will be turned on at specific time set by the user and it will turn off only when the user answers two simple mathematical questions correctly. Similar to the previous section, in this section, you will be reusing the LCD code that was developed in the digital clock section.

Connecting LCD pins, Raspberry Pi GPIO pins, and a speaker

As this is an extension of a digital clock section, first make sure that you have connected the LCD pins and Raspberry GPIO pins, as mentioned in the following screenshot. In addition to the connection that you have made, you have to connect the speaker with the 3.5 mm audio jack of Raspberry Pi.

Scripting

Once you have connected all the components as per the connection...