Object-oriented programming (OOP) is a programming paradigm that helps us divide our code into reusable components using classes and objects. An object is designed to model something. For example, we could create an LED object that will contain the properties and functionality we want for a LED; however, before we can create an object we need to have a blueprint for it. This blueprint is called a class. Let's see how this works by creating a class that will help us control a LED.
We will start off by creating two new tabs named led.cpp and led.h. The led.h file will contain the definition for the class, and the led.cpp file will contain the code. Let's start off by adding the following code to the led.h file:
#ifndef LED_H #define LED_H #define LED_ONE 3 #define LED_TWO 11 class Led{ int ledPin; long onTime; long offTime; public...