I'm having trouble with understanding the setup in my class. Could someone please explain me the reason behind giving 3 names to the same LED?
Here is my header:
class alarmLight {
public:
alarmLight(int pin_gre_1, int pin_gre_2, int pin_yel_1, int pin_yel_2, int pin_red, int pin_speaker);
functions etc.
void setup(int pinLed_gre_1, int pinLed_gre_2, int pinLed_yel_1, int pinLed_yel_2, int pinLed_red, int pin_SPEAKER);
private:
int led_gre_1;
int led_gre_2;
int led_yel_1;
int led_yel_2;
int led_red;
int speaker;
};
The cpp:
alarmLight::alarmLight(int pin_gre_1, int pin_gre_2, int pin_yel_1, int pin_yel_2, int pin_red, int pin_speaker) {
setup(pin_gre_1, pin_gre_2, pin_yel_1, pin_yel_2, pin_red, pin_speaker);
void alarmLight::setup(int pinLed_gre_1, int pinLed_gre_2, int pinLed_yel_1, int pinLed_yel_2, int pinLed_red, int pin_SPEAKER) {
led_gre_1 = pinLed_gre_1;
led_gre_2 = pinLed_gre_2;
led_yel_1 = pinLed_yel_1;
led_yel_2 = pinLed_yel_2;
led_red = pinLed_red;
speaker = pin_SPEAKER;
pinMode(led_gre_1, OUTPUT);
pinMode(led_gre_2, OUTPUT);
pinMode(led_yel_1, OUTPUT);
pinMode(led_yel_2, OUTPUT);
pinMode(led_red, OUTPUT);
pinMode(speaker, OUTPUT);
}