/*
    This sketch and the following series is an introduction for beginners to the use of structs and
    finally classes based on an example using LEDs.


    2023-04-13
    ec2021

   Content

   1. Without Struct I
   https://wokwi.com/projects/361903925541445633
   Basic solution to switch a LED on and off in given time periods

  2. Without Struct II
  https://wokwi.com/projects/361904006150737921
  Brute Force method to control three LEDs by copying variables and functions three times
  as often done by beginners

  3. Without Struct III
  https://wokwi.com/projects/361904503533363201
  Solution to control three LEDs using one dimensional arrays for the variables
  Much easier to maintain and add further LEDs.

  4. With Struct I
  https://wokwi.com/projects/361905006314083329
  Solution to control three LEDs with a struct for the LED specific variables and a function to switch
  the LEDs that uses the address operator & to handle the struct and not a copy of its data. There is
  a separate struct defined per LED.

  5. With Struct II
  https://wokwi.com/projects/361905620550035457
  The same solution as in 4. but this sketch defines an array of structs. This way it combines structs
  with the advantage of arrays as in 3.

  6. With Struct III
  https://wokwi.com/projects/361905909896214529
  This sketch is based on solution 4. but the struct includes now functions to initialize data and
  pins as well as the function to switch the LED on/off. The variables inside the struct are declared
  as "private" so that they can only be accessed and changed via the public functions.

  7. With Class I
  https://wokwi.com/projects/361906535848964097
  This sketch is identical to solution 6. except that the definition of "struct" has now been named
  "class". It shows that both are almost the same in C++. Just that every entry in a struct is public
  if not declared as private while in a class every entry is private if not explicitly declared as
  public.

  8. With Class II
  https://wokwi.com/projects/361906656826329089
  This sketch shows how to declare and use the constructor of a class to set variables and to perform
  required initialisation processes (like pinMode()).

  9. With Class III
  https://wokwi.com/projects/361908581431120897
  This sketch is identical to 8. but the class declaration has been moved to a separate file that is
  included in the main file by the #include instruction.

  last modification 2023-04-13 22:35 ec2021

*/
#include "ledType.h"

ledType greenLED( 13, 1000,  500);
ledType yellowLED(12,  500,  500);
ledType redLED(   14,  500, 1000);

void setup() {
  Serial.begin(115200);
  Serial.println("Start ");
  greenLED.begin();
  yellowLED.begin();
  redLED.begin();
}

void loop() {
  greenLED.switchLED();
  yellowLED.switchLED();
  redLED.switchLED();
}