We may earn an affiliate commission when you visit our partners.
Markus Edenhauser

Especially in the development of microcontrollers we often work with libraries, for example to control hardware components. The advantages of flexible and efficient source code design will be introduced to you in this course.

An ESP32 is used in the entire course, but all the examples (except the last one with the Website/Webserver and WIFI), exercises and explanations can be done with any Arduino.

Once you have completed this course, you will be able to…

Read more

Especially in the development of microcontrollers we often work with libraries, for example to control hardware components. The advantages of flexible and efficient source code design will be introduced to you in this course.

An ESP32 is used in the entire course, but all the examples (except the last one with the Website/Webserver and WIFI), exercises and explanations can be done with any Arduino.

Once you have completed this course, you will be able to…

  • ...create your own object-oriented programs and libraries

  • ...program reusable source code

  • ... create clean source code architecture for flexible programming and adaptation

  • ... code generalized classes and provide the libraries

  • ... implement the basic concepts of OOP for your own projects and apply them immediately.

  • ... save time for cumbersome programming. Because of the given conceptual design, your self-written code is easier to adapt.

  • ... maintain your own code better even after a longer period of time.

What we go through in the course:

  • Basics of object-oriented programming in the Arduino environment. We will go through the essential contents of OOP step by step. We will get right into practical examples.

  • Practical example: Own LED class. Many different functions and interfaces.

  • Practical example 2: Galton board with marble elevator and evaluation of 12 IR sensors.

  • Practical example 3: Headlamp with only one(. ) button, two LEDs and three light modes.

  • Practical example: Rock, paper, scissors game. We develop this small game. We compete against the bot and play to win two games. The logic is triggered by a web server on the ESP32 (with server side events).

My approach in the course:

  • None (ok, only very few) slides/Powerpoints. We start in the basics immediately with a practical example. Also the theory can be tested immediately on the Arduino with the Serial Monitor and thus immediately better understood.

  • The practical projects are developed together in step-by-step instructions.

  • Together means in this context that I demonstrate the code, depending on the task, and you can follow me along with the source code.

  • All codes are available for download on the platform, so you can get to the result without frustration.

  • No rambling explanations or theory monologues, we get right to work in the basics chapter.

Benefit from my years of experience and get the key skills in microcontroller development.

I'm looking forward to see you in class

Markus Edenhauser

Enroll now

What's inside

Learning objectives

  • The structure of a class
  • What data encapsulation is and how we implement this concept
  • Creation and use of constructors
  • Overloading constructors and functions (polymorphism)
  • Inheritance of classes
  • Use and adaptation of inherited classes
  • Interaction of headers and cpp files
  • Control of servo motors, infrared sensors, leds.
  • Use of visual studio code / platform io (with arduino ide also possible)
  • Provide of own libraries for external developers
  • Creation of individual libraries for own use
  • Best practices in object oriented programming of microcontrollers
  • Many practical examples which are built up step by step
  • Show more
  • Show less

Syllabus

Introduction
Introduction to this course
About me
Download code snippets
Read more
List of components
Practical experience vs. theory
Prerequisites for this course
Disclaimer
Basics
Intro
ESP32 Pinout
VS Code vs Arduino IDE
Open Source Code from VS Code in Arduino IDE
Online Simulator
Enum
Struct
Short introduction to object-oriented programming
Basic setting of an empty project
Structure of a class & data encapsulation
Instance and constructor
Overloading constructor
Exercise example Interaction of header and CPP files
Getter
Setter
Inheritance
Inherited function overloaded
Recap Introduction OOP
Quiz 1
Individual LED Class
Wiring and series resistance calculation
Headerfile
Control the LED with an object
Toggle LED
Turn LED off after x seconds
Fading
Pulsate
Instantiate objects in array
LED chasing effect
Quiz 2
IR sensors using the Galton board as an example
Project Introduction
Wiring
Create Project and Class
Address IR sensor individually
Objects into an array
Simulate Motor on off
Evaluation of the IR sensors
Craft Project Overview
Recap OOP IRSensors
Quiz 3
Headlamp - Button short/long click
Project idea
First game mode
Add Class Button
Debounce button with millis
Detect duration of clicks
Clean Interface
Control LEDs
ButtonHeadlamp inherits from Button
Function Keep button pressed
Add function Fade
Additional task implement LED class
Possible solution
Quiz 4
Rock Paper Scissors

If you use a platform version > 3.5, it can come to errors with the library of the web server as of 05/2022.


So for this example, use the following in platform.ini


platform = espressif32@3.5.0

Game mode in loop
Create a website
Access website via ESP32 Webserver
Transfer data from website to ESP32
Game mode on two games won
Sending Server Side Events
Prettify events
Implement LED Class
Housing
Publish your OOP source code as Arduino library
Create and publish your own library
Conclusion
Summary of the Learnings

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Uses the ESP32, a popular microcontroller, but ensures that most examples are compatible with any Arduino board, broadening accessibility for learners with different hardware
Emphasizes practical examples and step-by-step instructions, allowing learners to immediately apply theoretical concepts to real-world scenarios and projects
Focuses on creating reusable source code and clean architecture, which are essential for efficient programming and adaptation in various microcontroller projects
Teaches the creation of individual libraries for personal use and providing them to external developers, fostering collaboration and code sharing within the Arduino community
Includes a rock, paper, scissors game that uses a web server on the ESP32, which introduces learners to web-based interaction with microcontrollers
Suggests using platform version 3.5.0 due to potential errors with the web server library in later versions, which may require learners to downgrade their environment

Save this course

Save Introduction to object-oriented programming with Arduino to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Introduction to object-oriented programming with Arduino with these activities:
Review C++ Basics
Reinforce your understanding of C++ syntax and concepts, as Arduino programming relies heavily on C++. This will make grasping object-oriented concepts easier.
Show steps
  • Review data types, variables, and operators in C++.
  • Practice writing simple C++ programs.
  • Familiarize yourself with control flow statements (if, else, loops).
Review 'Object-Oriented Programming in C++' by Robert Lafore
Solidify your understanding of OOP concepts by reading a dedicated book on the subject. This will provide a broader and deeper understanding of the principles.
Show steps
  • Read the chapters on classes, objects, and inheritance.
  • Work through the examples and exercises in the book.
  • Relate the concepts to Arduino programming.
Review 'Arduino Cookbook' by Michael Margolis
Gain practical insights into Arduino programming by reviewing a cookbook. This will provide real-world examples of how to apply OOP concepts.
Show steps
  • Browse the book for relevant examples and code snippets.
  • Adapt the examples to your own projects.
  • Experiment with different approaches and techniques.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Create a Simple Arduino Library
Practice creating your own Arduino library to solidify your understanding of class structure, header files, and CPP files. This directly applies the course's learning objectives.
Show steps
  • Define a simple class with a few methods.
  • Create a header file and a CPP file for your class.
  • Write a simple Arduino sketch that uses your library.
  • Test your library and debug any errors.
Follow Advanced Arduino OOP Tutorials
Explore advanced OOP techniques in Arduino by following online tutorials. This will expose you to different approaches and best practices.
Show steps
  • Search for tutorials on advanced OOP concepts in Arduino.
  • Follow the tutorials and implement the examples.
  • Adapt the techniques to your own projects.
Document Your Arduino Library
Improve your understanding of library structure by documenting your own Arduino library. This reinforces the concepts of header files, CPP files, and class interfaces.
Show steps
  • Write clear and concise documentation for each class and method.
  • Create examples that demonstrate how to use your library.
  • Publish your documentation online.
Contribute to an Arduino Library
Deepen your understanding of library design and implementation by contributing to an open-source Arduino library. This provides valuable experience in working with existing codebases and collaborating with other developers.
Show steps
  • Find an open-source Arduino library that interests you.
  • Identify a bug or feature that you can contribute.
  • Submit a pull request with your changes.
  • Respond to feedback from the library maintainers.

Career center

Learners who complete Introduction to object-oriented programming with Arduino will develop knowledge and skills that may be useful to these careers:
Microcontroller Programmer
A microcontroller programmer writes software that runs on small, low-power processors embedded in various devices. This course provides direct training for such a role, emphasizing practical object-oriented programming on an Arduino platform. The course's curriculum, which covers reusable code, libraries, and clean architectures, is highly pertinent to the role. The microcontroller programmer can then use the skills learned from this course to create efficiently designed and maintainable code. The course's focus on hands-on projects—like the LED class and sensor interaction—aligns strongly with the daily tasks of a microcontroller programmer.
Firmware Engineer
A firmware engineer develops low-level software that interacts directly with hardware, often on microcontrollers. This course is an ideal fit since it provides hands-on experience with object-oriented programming on an Arduino platform, creating reusable code and libraries. The course directly addresses the fundamentals of working with hardware components like LEDs, sensors, and motors. The ability to create flexible code architectures, which this course provides, is essential for a firmware engineer to develop robust and well-organized embedded systems.
Mechatronics Engineer
A mechatronics engineer integrates mechanical, electrical, and computer engineering to design complex systems. This course directly helps the mechatronics engineer by providing hands-on experience with object-oriented programming of microcontrollers, which are central to mechatronics systems. The course focuses on reusable code, libraries, and clean architectures, enabling the mechatronics engineer to create robust and efficient embedded systems. The projects involving LEDs, sensors, and motor control, as covered in the course, directly align with the practical challenges faced by mechatronics engineers.
Embedded Systems Engineer
An embedded systems engineer designs, develops, and tests software for devices that are not traditional computers, such as those found in robotics, automobiles, and industrial equipment. This course directly applies to this role by providing practical experience in object-oriented programming (OOP) within the microcontroller environment, using Arduino as a testing ground. The focus on creating reusable source code and clean architectures is essential for building scalable and maintainable embedded systems. Furthermore, the hands-on projects involving LEDs, sensors, and motor control directly translate to the real-world challenges faced by an embedded systems engineer.
Control Systems Engineer
A control systems engineer designs and implements systems to regulate dynamic processes, often using microcontrollers and embedded systems. This course is highly beneficial because it provides practical experience with object-oriented programming on an Arduino platform, which is often used in control systems. The control systems engineer will benefit from the hands-on projects that involve controlling hardware components such as LEDs, sensors, and motors, as well as best practices in creating clean code architecture to build robust control systems. This course also helps the engineer implement the basic concepts of OOP to save time when programming.
Robotics Software Developer
A robotics software developer creates the software that controls the movement, perception, and behavior of robots. This course is highly relevant, since it emphasizes the development of reusable and modular object-oriented code, a key skill for programming complex robotic systems. The practical experience in controlling hardware components like LEDs, sensors, and servo motors through code, as covered in this course, is directly applicable to robotics development. The course also covers creating and using libraries, which helps the robotics software developer quickly assemble complex robotic functionalities.
Internet of Things Developer
An Internet of Things developer builds software for devices that connect to the internet, like smart home appliances and industrial sensors. This course directly prepares an IoT developer by introducing development on microcontrollers, especially the ESP32, and by creating programs to control hardware. The course provides a practical understanding of object oriented programming, which is essential for designing scalable and manageable IoT solutions. Hands-on experience with web server integration and sensor interaction, as taught in the course, are essential skills for this role.
Automation Engineer
An automation engineer designs and implements systems to automate industrial processes. This course helps an automation engineer by providing knowledge in microcontroller programming and hardware control. Object-oriented programming principles taught here help with the creation of robust software for control systems. The ability to develop, test, and debug software for controlling sensors and actuators translates to the real-world challenges faced by automation engineers, especially those in embedded automation.
Hardware Engineer
A hardware engineer designs and develops the physical components of electronic devices. While hardware design is the focus, this course is beneficial because it offers a strong foundation in understanding how software interacts with these components. The course's emphasis on object-oriented programming (OOP) with microcontrollers provides practical insights into how hardware is controlled, and will allow the hardware engineer to better understand the needs of the software engineers they will work with daily. The practical experience with LEDs, sensors, and motors provides valuable context for hardware development, and a basis for interdisciplinary collaboration.
Software Developer
A software developer creates computer programs for a variety of applications. This course offers practical experience in object-oriented programming, which is a fundamental concept for any software development role. Although this course focuses on microcontrollers and hardware, the software developer can take the principles of object-oriented design and apply them to high-level software projects. The course's teachings on reusable code, clean architecture and libraries will help any software developer write efficient and maintainable code.
Electrical Engineer
An electrical engineer designs and develops electrical systems and devices. Although primarily focused on hardware design, a deeper understanding of software interactions with hardware can improve an electrical engineer's effectiveness. This course provides the electrical engineer with practical experience in object oriented programming and an understanding of how microcontrollers function. The ability to implement code for hardware controls, such as LEDs and sensors, enhances the electrical engineer's ability to collaborate with software engineers and develop more holistic system solutions. The course may be especially useful for electrical engineers working in embedded systems.
Research Scientist
A research scientist often works on developing proof of concepts and prototypes for new technologies. This course can assist a research scientist in designing and building prototypes, especially in areas involving embedded systems, robotics, and sensor technologies. The ability to write modular, object oriented code, and to directly interface with hardware, which is core to this course, may prove to be essential for quickly creating and iterating on experimental designs. The course covers the programming of specific sensors and actuators that may also be useful in scientific data collection.
Product Developer
A product developer works on the design and development of new products. This course is particularly relevant if the product involves embedded systems, microcontrollers, or IoT devices. The experience gained in object-oriented programming, hardware control, and creating reusable code will give the product developer a stronger insight into the technologies being used in their product. While this role crosses a range of industries, this course may be useful for those involved in the development of connected devices. This course will help them evaluate technical options and limitations.
Software Test Engineer
A software test engineer creates and executes test plans to ensure software quality. This course provides experience in object-oriented programming with practical examples, which helps a tester understand how code is constructed, which is essential for designing comprehensive testing strategies. The course's approach to software development, including creating modular and reusable code, provides insights into potential failure points and areas that require specific testing attention. While not a direct development role, by learning about development, this course puts the software test engineer in a better position to do their work more effectively.
Technology Consultant
A technology consultant advises clients on technology strategy and implementation. This course provides practical experience with object-oriented programming in an embedded systems context. This will help the technology consultant when working in fields which use microcontrollers and embedded hardware. The course's emphasis on clean code architecture and reusable libraries can help the consultant better advise clients on technical best practices. While the consultant does not directly develop software, the knowledge gained from this course can provide useful insights into technical decision-making.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Introduction to object-oriented programming with Arduino.
Provides a comprehensive introduction to object-oriented programming concepts using C++. It covers topics such as classes, objects, inheritance, polymorphism, and data abstraction in detail. Reading this book will give you a solid foundation in OOP principles, which are essential for understanding and applying object-oriented programming with Arduino. It valuable resource for both beginners and experienced programmers.
Provides a collection of practical solutions and code snippets for common Arduino programming tasks. While not strictly focused on OOP, it offers valuable insights into how to structure Arduino projects and use libraries effectively. It can serve as a useful reference for implementing object-oriented designs in your Arduino projects. It is commonly used by hobbyists and professionals alike.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser