void
setup()
{
pinMode( 13, OUTPUT );
}
class Morse
{
enum
{
DOT_PAUSE = 100,
DASH_PAUSE = 3 * DOT_PAUSE,
LETTER_PAUSE = 4 * DOT_PAUSE,
WORD_PAUSE = 7 * DOT_PAUSE
};
public:
void
dot()
{
digitalWrite( 13, HIGH );
delay( DOT_PAUSE );
digitalWrite( 13, LOW );
delay( DOT_PAUSE );
}
void
dash()
{
digitalWrite( 13, HIGH );
delay( DASH_PAUSE );
digitalWrite( 13, LOW );
delay( DOT_PAUSE );
}
void
send_s()
{
dot();
dot();
dot();
delay( LETTER_PAUSE );
}
void
send_o()
{
dash();
dash();
dash();
delay( LETTER_PAUSE );
}
void
send_SOS()
{
send_s();
send_o();
send_s();
delay( WORD_PAUSE );
}
} morse_object;
void
loop()
{
morse_object.send_SOS();
}