loading
1 Comments

Tell us about yourself!

Complete Your Profile
  • DejanG5 commented on Bot1398's instructable Arduino Morse Code Flaher8 months ago
    Arduino Morse Code Flaher

    Here is my version (for situations when conservation of memory IS an issue). Transmits a stored message over and over again by simply flashing the built in LED on Arduino Nano or Digispark.I have used a struct to encode dash-dot sequence for each letter in a bit field and the number of symbols for each letter:struct mc {unsigned char dd;unsigned char len;};Using something likestruct mc {unsigned int dd:6;unsigned int len:3;};performs the same, using exactly the same amount of memory (because we need 6+3=9 bits for each letter) and the produced code is even slightly longer.The Morse equivalents of all the letters are stored in an arrayconst struct mc mrs[] = { // right to left bit encoded, 1=-; 0=. , only len rightmost bits valid.../* A = ".-" */ { 0b000010, 2},/* B = "-.....see more »Here is my version (for situations when conservation of memory IS an issue). Transmits a stored message over and over again by simply flashing the built in LED on Arduino Nano or Digispark.I have used a struct to encode dash-dot sequence for each letter in a bit field and the number of symbols for each letter:struct mc {unsigned char dd;unsigned char len;};Using something likestruct mc {unsigned int dd:6;unsigned int len:3;};performs the same, using exactly the same amount of memory (because we need 6+3=9 bits for each letter) and the produced code is even slightly longer.The Morse equivalents of all the letters are stored in an arrayconst struct mc mrs[] = { // right to left bit encoded, 1=-; 0=. , only len rightmost bits valid.../* A = ".-" */ { 0b000010, 2},/* B = "-..." */ { 0b000001, 4},/* C = "-.-." */ { 0b000101, 4},...Here is the sketch file. Feel free to use it or comment.

    View Instructable »