Telegraph - Morse encoder/decoder

Here is one example: Problem in order of execution of functions however, the decoding is done on an Arduino, not on a PC.