Hello,
I have read the creating library-tutorial which uses morse-code as the example (beeping S-O-S)
inside the example a lot of different things in different places all were named "morse".
Does this mean that these names have to be the same or is it just a c-programmers habit to name it this way?
I know code should be written in brackets but the colors seem not to work inside code-blocks
header-file
class Morse
{
public:
Morse(int pin);
void dot();
void dash();
private:
int _pin;
};
Does the red word "Morse" have to be the same as the green word "Morse"?
cpp-file
If the words don't have to be the same which one th red or the green one is related to the "Morse"-word in the cpp-file?
Morse::Morse(int pin)
{
pinMode(pin, OUTPUT);
_pin = pin;
}
void Morse::dot()
{
digitalWrite(_pin, HIGH);
delay(250);
digitalWrite(_pin, LOW);
delay(250);
}
void Morse::dash()
{
digitalWrite(_pin, HIGH);
delay(1000);
digitalWrite(_pin, LOW);
delay(250);
}
If these words can be different I guess easiest way to understand is to re-write this code-example with names that differ. I suggest to add a prefix that says something about what the word means at this place. Example className_Morse
best regards
Stefan