Chapter 11. Conditional Statements, Functions, and Lists
In this chapter, we will build upon what you learned in the previous chapter. You will learn about conditional statements and how to make use of logical operators to check conditions using conditional statements. Next, you will learn to write simple functions in Python and discuss interfacing inputs to the Raspberry Pi's GPIO header using a tactile switch (momentary push button). We will also discuss motor control (this is a run-up to the final project) using the Raspberry Pi Zero and control the motors using the switch inputs. Let's get to it! In this chapter, we will discuss the following topics:
- Conditional statements in Python
- Using conditional inputs to take actions based on GPIO pin states
- Breaking out of loops using conditional statement
- Functions in Python
- GPIO callback functions
- Motor control in Python