Arduino OOP—Object-Oriented Programming

Video description

Do you want to write Arduino code that you can easily read, modify, and share with other Arduino developers? Or do you already know OOP (Object-Oriented Programming) and you want to know how to apply it to Arduino? Then this course is for you.

In this course, you will learn how to create a first class (for an LED component), then organize the class, and separate the interface from the implementation. Next, it will be your turn to write OOP code for a push button. Later, you will learn how to create a class to make an LED blink (how to use a class inside another class). Finally, you will get a chance to create the final TrafficLight class with high-level logic, while using all the previous classes you have created in this course.

By the end of this course, you will be able to write clean Arduino code with OOP for any hardware component or functionality, rewrite your own projects using OOP, and create a clean and super easy-to-use OOP Arduino library.

What You Will Learn

  • Package a class as an easy-to-use Arduino library
  • Write a class for any Arduino component or functionality
  • Create clear interfaces for other developers to use
  • Learn how to use a class inside another class
  • Learn naming conventions for Arduino OOP code
  • Learn how to clearly organize your code in different files

Audience

This course is intended for individuals who are familiar with the fundamentals of Arduino time functionality as well as the creation of simple Arduino programs using simple hardware components.

This course can be useful for students, engineers, researchers, teachers, developers, and Arduino developers who want to produce scalable, easy-to-read code or who want to construct Arduino libraries with a clear user interface.

This course can also be helpful to those who already have a working understanding of OOP and want to learn how to use it with Arduino.

About The Author

Edouard Renard: Edouard Renard is a software engineer, entrepreneur, and robotics teacher. He really enjoys teaching new technologies to people and making complex stuff easy to understand. His method is simple and consists of only three words: step by step. Edouard knows how hard it can be to learn a new topic and just be lost in an ocean of information without knowing what to do. In his courses, he makes sure that you learn one step at a time, through practice, and that you also learn the best practices.

He is passionate about robotics and found that it’s amazing how many cool projects you can do with a robot when you have the required programming knowledge.

Table of contents

  1. Chapter 1 : Introduction
    1. Welcome!
    2. Why OOP for Arduino?
    3. List of Materials
    4. Software Setup for the Course
    5. Project Overview and How to Get the Most Out of This Course
  2. Chapter 2 : Your First Arduino Class - LED
    1. Introduction
    2. Create the LED Class Structure
    3. Add Attributes to the LED Class
    4. The LED Class Constructor
    5. Add Methods to the LED Class
    6. Use Your Class in Your Program - Create an LED Object
  3. Chapter 3 : Organize the Class in a Clear Way
    1. Introduction
    2. Create a Header File for the Class
    3. Create a cpp File - Separate the Interface from the Implementation
    4. Recap and How to Use and Read the Interface
    5. Extra: Make Your Class an Arduino Library
  4. Chapter 4 : Circuit for the Course
    1. Build the Circuit Step by Step
  5. Chapter 5 : Your Turn - Push Button Class
    1. Introduction
    2. Create the PushButton Class Header File - Interface
    3. Create the PushButton Class cpp File - Implementation
    4. Create a PushButton Object to Read the Button's State
    5. Handle Pull Up and Pull Down Resistors in the Class
    6. Add More Abstraction to Know When the Button Is Pressed
    7. Debounce the Button Inside the Class
    8. Combine LEDs and Buttons - Work with Multiple Objects
  6. Chapter 6 : LEDBlinker - Use a Class Inside Another Class
    1. Introduction
    2. Create the LEDBlinker Class and Init the LED Inside
    3. Toggle LED State from LEDBlinker
    4. Make the LED Blink Without Delay - Inside the Class
    5. Add Some Getters and Setters
    6. Application Example - Make Three LEDs Blink at Different Rates
  7. Chapter 7 : Your Turn - Traffic Light System
    1. Introduction- Final Project Overview
    2. The Interface and Main Program (Help to Get Started)
    3. Set Up the Traffic Light Class
    4. Add Methods to Init and Toggle Between the LEDs
    5. Add a State Machine Inside the Class
    6. Use Time Functionalities to Wait Between Different States
    7. Create a Class for the Potentiometer
    8. Modify the LED's Brightness with the Potentiometer
  8. Chapter 8 : Conclusion
    1. Project Conclusion and Improvements
    2. How to Build an Arduino Project with OOP - Best Practices
    3. What to Do Next

Product information

  • Title: Arduino OOP—Object-Oriented Programming
  • Author(s): Edouard Renard
  • Release date: August 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781804614945