A morse decoder for arduino |
An algorithm for decoding Morse code with arduino, some inspiration from this article
From wikipedia:
The perfect morse code needs:
The real morse code has a dot:dash ratio of 2.5:1 to 3.5:1 Firstly, we need to determine this ratio:
If the inter-element gap length is denoted as Tm and dot as Td:
Use the first ten time lengths to calculate Tm and Td
High Level Time=H_TIME [ie not pressing]
Low Level Time=L_TIME [ie key pressing]
blank a dot/dash array
R=H_TIME[n]/Tm
If (R with 0.5 and 1.5) {
S=L_TIME[n-1]/Td
if (S within 2.5 and 3.5) {
dash
} else {
dot
}
advance to next element in dot/dash array
} else if R (within 2.5-3.5) {
we have a letter space hence decode array
}
Another algorithm obtained from here can be summarised in this diagram
![]() |
mnicolao added:01-12-2011 22:20 |