You could do the table as a binary tree. Lets say dot means 0 and dash means 1. Then you need a table of 32 elements (because the tree has a depth of 5). You would construct the pointer by left shifting your dot and dash representations. So lets say you receive morse code for 8 (because numbers are coded by 5 symbols) - - - . . => 11100 => go to table element 28. When you get illegal code you could print an error, wait for a pause in received code (start of next character) and decode next character.
Yes, I should have done this using a binary tree, it would be more professional and maybe even easier to implement in the code but... :) Maybe I will rewrite the code. Thanks :) ...and Thank You for watching! Cheers!
Wow! Excellent progress!! Very cool, and thanks for sharing
Thank You Rudy :) Well I could implement the whole Morse code table but this is just demo so... Cheers!
You could do the table as a binary tree. Lets say dot means 0 and dash means 1. Then you need a table of 32 elements (because the tree has a depth of 5). You would construct the pointer by left shifting your dot and dash representations. So lets say you receive morse code for 8 (because numbers are coded by 5 symbols) - - - . . => 11100 => go to table element 28.
When you get illegal code you could print an error, wait for a pause in received code (start of next character) and decode next character.
Yes, I should have done this using a binary tree, it would be more professional and maybe even easier to implement in the code but... :) Maybe I will rewrite the code. Thanks :) ...and Thank You for watching! Cheers!
Very nice explanation
Thank You :) Cheers!