Pages: 1 [2]   Go Down
Author Topic: morse code flasher - lookup table question  (Read 2376 times)
0 Members and 1 Guest are viewing this topic.
Worst state in America
Offline Offline
God Member
*****
Karma: 32
Posts: 792
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Krupski!  That's definitely what I had in mind, though I was going to use binary (0s for dits, 1s for dahs) for the pattern.

Can you explain why you're subtracting 'A' from each character?  I don't quite understand that.


Sure. If the letter "A" comes in, it's ASCII value is 65 decimal. To convert it to a zero based index, you subtract 65 from it (i.e. 'A').

So:
A=65-65 = 0
B=66-65 = 1
C=67-65 = 2
...etc..

see?
Logged

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 8
KE5CPU
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, sir. Perfectly. Thank you!
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 8
KE5CPU
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 JavaMan, In looking back over the posts, I realize that I overlooked your post.  What you have written is VERY similar to what I had in mind when I wrote the pseudocode, with the exception of your case statement.  I visualized using a lookup_table (array).

Very nice!  Very clean code!

Thanks!
Logged

Southern California
Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
JavaMan, In looking back over the posts, I realize that I overlooked your post.  What you have written is VERY similar to what I had in mind when I wrote the pseudocode, with the exception of your case statement.  I visualized using a lookup_table (array).

Very nice!  Very clean code!

Thanks!

AlphaTango,

Thanks for the kind words. I used the case statement instead of an array because it seemed like a more intuitive way to add additional characters. By the way, the comment regarding frequency adjustment is an artifact of another version that beeps instead of flashes.

Tom
Logged

Pages: 1 [2]   Go Up
Jump to: