Button press/or serial command

Hello folks, I've got the code here working fine except for one issue.

This code WILL print codes entered into serial and both flash the LED and buzzer
This code WILL send the commands if pins are HIGH
This code WILL NOT stop cycling through the commands with out without a button pressed.

I'm clearly overlooking a code and am new to coding so this isn't a surprise. I'm hoping someone can spot the missing or wrong code and help me out with an open source project I'm making.

Thank you in advance.

EDIT: Correct formatted code below

Also I've coded it as if (digitalRead(pinxxxx) == HIGH) as well as LOW

Please post code that can be downloaded to the IDE and compiled. The stuff You posted will not do that.

Sorry about that, switched to a different PC

EDIT: Correct formatted code below

Let me know if this didn't come through correctly, I first used the preformatted text button, then used the quote button which again instructed me to use the preformatted text button so I selected "post anyways"

No it did not. Do not use the quote button. Use "Copy for forum" in the ide window and then paste in forum. It will add the code tags.

flash_morse_code(mCodes[ch == "1"]);

All the lines like this are wrong. The double quotes are a character string and not a single char. Even if you do compare to a char using single quotes like '1', the == will only return 0 or 1 and not all the indexes.


//Software details, only edit lines with editme tags
//OTMK Version 1.1.0
//Version date: 3/28/22
//Contributors: Jeremy E
//Software not to be edited by anyone other than OTMK Moderators, OTMK Administrators or OTMK Engineers


//Hello?
//Dad? Is that you?
//Initialize SWAN Protocall
//Warning
//***entered***4 8 15 16 23 42
//WALT?!
//WALT!
  
//editme
char callSign[] = "Test Call Sign";
//editme

unsigned int led_pin = 13;
const int buzzer = 2;
const int buttonPin = 10;
const int Pinone = 3;
const int Pintwo = 4;
const int Pinthr = 5;
const int Pinfou = 6;
const int Pinfiv = 7;
const int Pinsix = 8;

long randNumber;
 
// Declare an array named letters that holds addresses of string literals 
// (i.e. an array of pointers to strings composed of dots and dashes) 
// Done to preserve memory because strings are not equal in size. A 2D array
// would be a waste of space.


char *mCodes[] = {
  //OTMK Codes
  "-.-. --.- -.-. --.- -.-. --.- ", "--.- ... .-..", "callSign","randNumber = random(1000001,99999)","SK",
};


char *letters[] = {
  // The letters A-Z in Morse code  
  ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..",    
  ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.",  
  "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."         
};
 
char *numbers[] = {
  // The numbers 0-9 in Morse code  
  "-----", ".----", "..---", "...--", "....-", ".....", "-....", 
  "--...", "---..", "----."
};
 
unsigned int dot_duration = 75;
bool done = false;
 
/**
 *  Function runs only once, after each powerup or reset of the Arduino
 */
void setup() {
 
pinMode(buttonPin, OUTPUT);
  pinMode(led_pin, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(Pinone, INPUT);
  pinMode(Pintwo, INPUT);
  pinMode(Pinthr, INPUT);
  pinMode(Pinfou, INPUT);
  pinMode(Pinfiv, INPUT);
  pinMode(Pinsix, INPUT);
  digitalWrite(10, HIGH);
  
   
  // Open the serial port and set the data transmission rate to 9600 bits 
  // per second. 9600 is the default baud rate for Arduino.
  Serial.begin(9600); 
   
  // Show welcome message as human-readable ASCII text
  Serial.println("OTMK Serial Logger Interface");
  Serial.println("This program monitors your output codes");
  Serial.println("controls the peizo buzzer and LED indicators");
  Serial.println("Author: ONE TIME MORSE KEY");
  Serial.println("");
  Serial.println("While connected to serial, you can manually enter");
  Serial.println("morse codes strings to transmit or '!' to exit the program which will require reboot ");
}
 
/**
 *  Main function that drives the system
 */
void loop() {
  char ch;

  while (!done) {

  if (digitalRead(Pinone) ==  LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == "1"]);
             Serial.println("Your transmision 'CQ CQ CQ'");
  }

    if (digitalRead(Pintwo) ==  LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == "2"]);
             Serial.println("Your transmision 'QSL QSL'");
  }

      if (digitalRead(Pinthr) == LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == "3"]);
             Serial.println("Your transmision");
             Serial.println(callSign);
  }
        if (digitalRead(Pinfou) == LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == ""]);
             Serial.println("Your transmision");
             Serial.println("OTMK ******");
  }

          if (digitalRead(Pinfiv) == LOW){
              digitalWrite(led_pin, HIGH);
              tone(buzzer, 700);}

           if (digitalRead(Pinfiv) == LOW) 
                digitalWrite(led_pin, LOW);
                 noTone(buzzer);
             
  
   
   

    if (Serial.available()) {     
   
      // Read one letter or number at a time
      // Serial.read() returns the first (oldest) character in the buffer 
      // and removes that byte of data from the buffer
      ch = Serial.read();    
   
      // Check for uppercase letters
      if (ch >= 'A' && ch <= 'Z') {
        Serial.println(ch);
        flash_morse_code(letters[ch - 'A']);        
      }
      // Check for lowercase letters
      else  if (ch >= 'a' && ch <= 'z') {
        Serial.println(ch);
        flash_morse_code(letters[ch - 'a']);
      }
      // Check for numbers
      else if (ch >= '0' && ch <= '9') {
        Serial.println(ch);
        flash_morse_code(numbers[ch - '0']);
      }
      // Check for space between words
      else if (ch == ' ') {
       
        // Put space between two words in a message...equal to seven dots
        delay(dot_duration * 7);       
      }
      // Check for sentinel value
      else if (ch == '!') {
        done = true;  
        Serial.println("Thank you! Your messages were sent successfully.");
        Serial.println("Goodbye."); 

      }
    }     
  }  
  // Do nothing
  while(true) {}
}
 
/**
  *  Flashes the Morse code for the input letter or number
  *  @param morse_code pointer to the morse code
  */
void flash_morse_code(char *morse_code) {
    
  unsigned int i = 0;
    
  // Read the dots and dashes and flash accordingly
  while (morse_code[i] != NULL) {
    flash_dot_or_dash(morse_code[i]);
    i++;
  }
    
  // Space between two letters is equal to three dots
  delay(dot_duration * 3);    
}
 
/**
  *  Flashes the dot or dash in the Morse code
  *  @param dot_or_dash character that is a dot or a dash
  */
void flash_dot_or_dash(char dot_or_dash) {
   
  // Make the LED shine
  digitalWrite(led_pin, HIGH);
  tone(buzzer, 700);
   
  if (dot_or_dash == '.') { // If it is a dot
    delay(dot_duration);           
  }
  else { // Has to be a dash...equal to three dots
    delay(dot_duration * 3);           
  }
   
  // Turn the LED off
  digitalWrite(led_pin, LOW);
  noTone(buzzer);
 
  // Give space between parts of the same letter...equal to one dot
  delay(dot_duration); 
}

I've never used that function, thank you for that. Any chance you can guide me through this? It seems to be working fine on the Serial side. Considering it's morse I have verified the light flashes or tones coming from the buzzer are correct.

I copied the main code from another person's project that said it worked, and added the mcode string and if button high snippets

Yes, the button code needs work.

What kind of buttons are you using, and how are your buttons wired? Do you have external pullup or pulldown resistors to keep them from floating? Do they read HIGH or LOW when pressed?

One point for you to think about is that the indexes of an array start at 0. Your five OTMK codes are accessed with index values of 0 through 4. Which pin do you want to trigger which mCode?

The code for pin5 makes no sense. It is missing some brackets and does different things for the same reading of LOW.

if (digitalRead(Pinfiv) == LOW){
              digitalWrite(led_pin, HIGH);
              tone(buzzer, 700);}

 if (digitalRead(Pinfiv) == LOW) 
           digitalWrite(led_pin, LOW);
           noTone(buzzer);

Using a whisker switch as a morse key. No resistors. The whisker switch is going into a multiplexer to switch between outputs.

should I give it a >= (1000) rule so it'll take into consideration float without extra compnents?

I would like to have 1 outlet going to the multiplexer, the multiplexer switches to pins 1-6, when the whisker switch is actuated it completes circuit to the expected pin and commands the required command.

As for the pin 5 is was typo, it has since been fixed

          if (digitalRead(Pinfiv) == HIGH){
              digitalWrite(led_pin, HIGH);
              tone(buzzer, 700);}

           if (digitalRead(Pinfiv) == LOW) 
                digitalWrite(led_pin, LOW);
                 noTone(buzzer);

I am not clear about your circuit, either what you have or what you want. Can you please attach a hand drawn circuit diagram. Can you provide a link to the "whisker switch" you are using.

I understand that you want to physically select/activate one of 6 values(inputs) to trigger a message but the mechanics of what you are doing is not clear to me.

If you are going to use the circuit you show, where you are switching 5v from pin 10 to the multiplexer inputs you will need to put pulldown resistors to ground on the 6 input pins.

An alternative arrangement would be to use INPUT_PULLUP and the internal pullup resistor on the six inputs. The NO whisker switch will connect them through the knob multiplexer to ground instead of to 5v.

Either way, the six inputs need to have a definite state active and inactive. Making certain the inputs are not "floating" but are always in a known state is your first task.

Let me know what you chose, and if the input will read HIGH or LOW when the whisker switch is pressed.

(disregard)For sake of simplicity I'll go with the alternative option so I can keep the open source project components as few as possible, thank you! (disregard)

Perhaps I misread, I think the first option would actually be better utilizing the internal pullups

No. With the internal pullups there is 5v (through the pullup resistor) on the input at all times. If you then switch a 5v external signal to the input, you can't tell the difference.

Using the internal pullups enabled with INPUT_PULLUP pin mode requires the input to be switched to ground to read a change.

Beautiful, thank you so much for your help, May I attribute you in the credits to help with the program? I can do a user name, full name, first name and initial or if you happen to be a HAM operator your call sign.

Post your latest code. Do you have the switch messages sent as you want?


//Software details, only edit lines with editme tags
//OTMK Version 1.1.0
//Version date: 3/28/22
//Contributors: Jeremy E
//Software not to be edited by anyone other than OTMK Moderators, OTMK Administrators or OTMK Engineers


//Hello?
//Dad? Is that you?
//Initialize SWAN Protocall
//Warning
//***entered***4 8 15 16 23 42
//WALT?!
//WALT!
  
//editme
char callSign[] = "Test Call Sign";
//editme

unsigned int led_pin = 13;
const int buzzer = 2;
const int buttonPin = 10;
const int Pinone = 3;
const int Pintwo = 4;
const int Pinthr = 5;
const int Pinfou = 6;
const int Pinfiv = 7;
const int Pinsix = 8;

long randNumber;
 
// Declare an array named letters that holds addresses of string literals 
// (i.e. an array of pointers to strings composed of dots and dashes) 
// Done to preserve memory because strings are not equal in size. A 2D array
// would be a waste of space.


char *mCodes[] = {
  //OTMK Codes
  "-.-. --.- -.-. --.- -.-. --.- ", "--.- ... .-..", "callSign","randNumber = random(1000001,99999)","SK",
};


char *letters[] = {
  // The letters A-Z in Morse code  
  ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..",    
  ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.",  
  "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."         
};
 
char *numbers[] = {
  // The numbers 0-9 in Morse code  
  "-----", ".----", "..---", "...--", "....-", ".....", "-....", 
  "--...", "---..", "----."
};
 
unsigned int dot_duration = 75;
bool done = false;
 
/**
 *  Function runs only once, after each powerup or reset of the Arduino
 */
void setup() {
 
pinMode(buttonPin, OUTPUT);
  pinMode(led_pin, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(Pinone, INPUT_PULLUP);
  pinMode(Pintwo, INPUT_PULLUP);
  pinMode(Pinthr, INPUT_PULLUP);
  pinMode(Pinfou, INPUT_PULLUP);
  pinMode(Pinfiv, INPUT_PULLUP);
  pinMode(Pinsix, INPUT_PULLUP);
  digitalWrite(10, HIGH);
  digitalWrite(Pinone, HIGH);
  digitalWrite(Pintwo, HIGH);
  digitalWrite(Pinthr, HIGH);
  digitalWrite(Pinfou, HIGH);
  digitalWrite(Pinfiv, HIGH);
  digitalWrite(Pinsix, HIGH);
  
  
   
  // Open the serial port and set the data transmission rate to 9600 bits 
  // per second. 9600 is the default baud rate for Arduino.
  Serial.begin(9600); 
   
  // Show welcome message as human-readable ASCII text
  Serial.println("OTMK Serial Logger Interface");
  Serial.println("This program monitors your output codes");
  Serial.println("controls the peizo buzzer and LED indicators");
  Serial.println("Author: ONE TIME MORSE KEY");
  Serial.println("");
  Serial.println("While connected to serial, you can manually enter");
  Serial.println("morse codes strings to transmit or '!' to exit the program which will require reboot ");
}
 
/**
 *  Main function that drives the system
 */
void loop() {
  char ch;

  while (!done) {

  if (digitalRead(Pinone) ==  LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == "-.-. --.- -.-. --.- -.-. --.- "]);
             Serial.println("Your transmision 'CQ CQ CQ'");
  }

    if (digitalRead(Pintwo) == LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == ""]);
             Serial.println("Your transmision 'QSL QSL'");
  }

      if (digitalRead(Pinthr) == LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == ""]);
             Serial.println("Your transmision");
             Serial.println(callSign);
  }
        if (digitalRead(Pinfou) == LOW){
             Serial.println(ch);
             flash_morse_code(mCodes[ch == ""]);
             Serial.println("Your transmision");
             Serial.println("OTMK ******");
  }

          if (digitalRead(Pinfiv) == LOW){
              digitalWrite(led_pin, HIGH);
              tone(buzzer, 700);}

           if (digitalRead(Pinfiv) == HIGH) 
                digitalWrite(led_pin, LOW);
                 noTone(buzzer);
             
  
   
   

    if (Serial.available()) {     
   
      // Read one letter or number at a time
      // Serial.read() returns the first (oldest) character in the buffer 
      // and removes that byte of data from the buffer
      ch = Serial.read();    
   
      // Check for uppercase letters
      if (ch >= 'A' && ch <= 'Z') {
        Serial.println(ch);
        flash_morse_code(letters[ch - 'A']);        
      }
      // Check for lowercase letters
      else  if (ch >= 'a' && ch <= 'z') {
        Serial.println(ch);
        flash_morse_code(letters[ch - 'a']);
      }
      // Check for numbers
      else if (ch >= '0' && ch <= '9') {
        Serial.println(ch);
        flash_morse_code(numbers[ch - '0']);
      }
      // Check for space between words
      else if (ch == ' ') {
       
        // Put space between two words in a message...equal to seven dots
        delay(dot_duration * 7);       
      }
      // Check for sentinel value
      else if (ch == '!') {
        done = true;  
        Serial.println("Thank you! Your messages were sent successfully.");
        Serial.println("Goodbye."); 

      }
    }     
  }  
  // Do nothing
  while(true) {}
}
 
/**
  *  Flashes the Morse code for the input letter or number
  *  @param morse_code pointer to the morse code
  */
void flash_morse_code(char *morse_code) {
    
  unsigned int i = 0;
    
  // Read the dots and dashes and flash accordingly
  while (morse_code[i] != NULL) {
    flash_dot_or_dash(morse_code[i]);
    i++;
  }
    
  // Space between two letters is equal to three dots
  delay(dot_duration * 3);    
}
 
/**
  *  Flashes the dot or dash in the Morse code
  *  @param dot_or_dash character that is a dot or a dash
  */
void flash_dot_or_dash(char dot_or_dash) {
   
  // Make the LED shine
  digitalWrite(led_pin, HIGH);
  tone(buzzer, 700);
   
  if (dot_or_dash == '.') { // If it is a dot
    delay(dot_duration);           
  }
  else { // Has to be a dash...equal to three dots
    delay(dot_duration * 3);           
  }
   
  // Turn the LED off
  digitalWrite(led_pin, LOW);
  noTone(buzzer);
 
  // Give space between parts of the same letter...equal to one dot
  delay(dot_duration); 
}

the callsign pin doesn't transmit, neither does the random number. Perhaps those need some looking after as well?

Just to confirm, do you have the selection reading LOW when selected, and pin10 which is still set HIGH outputting 5v is not connected to the selector switch.

There are issues with the call sign and the random number. I have added some comments to the code and made some revisions. You need to address the mCode char* by index.

Let me know about the call sign you want, and work on the random number issue. I'm not certain you can do it with the character array pointers as written.

//Software details, only edit lines with editme tags
//OTMK Version 1.1.0
//Version date: 3/28/22
//Contributors: Jeremy E
//Software not to be edited by anyone other than OTMK Moderators, OTMK Administrators or OTMK Engineers


//Hello?
//Dad? Is that you?
//Initialize SWAN Protocall
//Warning
//***entered***4 8 15 16 23 42
//WALT?!
//WALT!

//editme
char callSign[] = "Test Call Sign"; //is this what you want sent or the mCode pointer?
//editme

unsigned int led_pin = 13;
const int buzzer = 2;
const int buttonPin = 10;
const int Pinone = 3;
const int Pintwo = 4;
const int Pinthr = 5;
const int Pinfou = 6;
const int Pinfiv = 7;
const int Pinsix = 8;

long randNumber;

// Declare an array named letters that holds addresses of string literals
// (i.e. an array of pointers to strings composed of dots and dashes)
// Done to preserve memory because strings are not equal in size. A 2D array
// would be a waste of space.


 char *mCodes[] = {
  //OTMK Codes
  "-.-. --.- -.-. --.- -.-. --.- ", "--.- ... .-..", "callSign", "randNumber = random(1000001,99999)", "SK",
};


char *letters[] = {
  // The letters A-Z in Morse code
  ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..",
  ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.",
  "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."
};

char *numbers[] = {
  // The numbers 0-9 in Morse code
  "-----", ".----", "..---", "...--", "....-", ".....", "-....",
  "--...", "---..", "----."
};

unsigned int dot_duration = 75;
bool done = false;

/**
    Function runs only once, after each powerup or reset of the Arduino
*/
void setup() {

  pinMode(buttonPin, OUTPUT);
  pinMode(led_pin, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(Pinone, INPUT_PULLUP);
  pinMode(Pintwo, INPUT_PULLUP);
  pinMode(Pinthr, INPUT_PULLUP);
  pinMode(Pinfou, INPUT_PULLUP);
  pinMode(Pinfiv, INPUT_PULLUP);
  pinMode(Pinsix, INPUT_PULLUP);
  digitalWrite(10, HIGH);
  //these line just duplicate INPUT_PULLUP using alternative syntax
  //digitalWrite(Pinone, HIGH);
  //digitalWrite(Pintwo, HIGH);
  //digitalWrite(Pinthr, HIGH);
  //digitalWrite(Pinfou, HIGH);
  //digitalWrite(Pinfiv, HIGH);
  //digitalWrite(Pinsix, HIGH);



  // Open the serial port and set the data transmission rate to 9600 bits
  // per second. 9600 is the default baud rate for Arduino.
  Serial.begin(9600);

  // Show welcome message as human-readable ASCII text
  Serial.println("OTMK Serial Logger Interface");
  Serial.println("This program monitors your output codes");
  Serial.println("controls the peizo buzzer and LED indicators");
  Serial.println("Author: ONE TIME MORSE KEY");
  Serial.println("");
  Serial.println("While connected to serial, you can manually enter");
  Serial.println("morse codes strings to transmit or '!' to exit the program which will require reboot ");
}

/**
    Main function that drives the system
*/
void loop() {
  char ch;

  while (!done) {

    if (digitalRead(Pinone) ==  LOW) {
      //Serial.println(ch);
      //flash_morse_code(mCodes[ch == "-.-. --.- -.-. --.- -.-. --.- "]);
      Serial.println(mCodes[0]);
      flash_morse_code(mCodes[0]);
      Serial.println("Your transmision 'CQ CQ CQ'");
    }

    if (digitalRead(Pintwo) == LOW) {
      //Serial.println(ch);
      //flash_morse_code(mCodes[ch == ""]);
      Serial.println(mCodes[1]);
      flash_morse_code(mCodes[1]);
      Serial.println("Your transmision 'QSL QSL'");
    }
    //its not clear which callsign you want to transmit
    //char callSign[] = "Test Call Sign";
    //mCode[2] = "callsign"
    if (digitalRead(Pinthr) == LOW) {
      //Serial.println(ch);
      //flash_morse_code(mCodes[ch == ""]);
      Serial.println(mCodes[2]);
      flash_morse_code(mCodes[2]);
      Serial.println("Your transmision");
      Serial.println(callSign);
    }
    //random number transmission is not working correctly
    if (digitalRead(Pinfou) == LOW) {
      //Serial.println(ch);
      //flash_morse_code(mCodes[ch == ""]);
      Serial.println(mCodes[3]);     
      flash_morse_code(mCodes[3]);//should be random number
      Serial.println("Your transmision");
      Serial.println("OTMK ******");
    }

    if (digitalRead(Pinfiv) == LOW) {
      digitalWrite(led_pin, HIGH);
      tone(buzzer, 700);
    }

    if (digitalRead(Pinfiv) == HIGH)
      digitalWrite(led_pin, LOW);
    noTone(buzzer);


    if (Serial.available()) {

      // Read one letter or number at a time
      // Serial.read() returns the first (oldest) character in the buffer
      // and removes that byte of data from the buffer
      ch = Serial.read();

      // Check for uppercase letters
      if (ch >= 'A' && ch <= 'Z') {
        Serial.println(ch);
        flash_morse_code(letters[ch - 'A']);
      }
      // Check for lowercase letters
      else  if (ch >= 'a' && ch <= 'z') {
        Serial.println(ch);
        flash_morse_code(letters[ch - 'a']);
      }
      // Check for numbers
      else if (ch >= '0' && ch <= '9') {
        Serial.println(ch);
        flash_morse_code(numbers[ch - '0']);
      }
      // Check for space between words
      else if (ch == ' ') {

        // Put space between two words in a message...equal to seven dots
        delay(dot_duration * 7);
      }
      // Check for sentinel value
      else if (ch == '!') {
        done = true;
        Serial.println("Thank you! Your messages were sent successfully.");
        Serial.println("Goodbye.");

      }
    }
  }
  // Do nothing
  while (true) {}
}

/**
     Flashes the Morse code for the input letter or number
     @param morse_code pointer to the morse code
*/
void flash_morse_code(char *morse_code) {

  unsigned int i = 0;

  // Read the dots and dashes and flash accordingly
  while (morse_code[i] != NULL) {
    flash_dot_or_dash(morse_code[i]);
    i++;
  }

  // Space between two letters is equal to three dots
  delay(dot_duration * 3);
}

/**
     Flashes the dot or dash in the Morse code
     @param dot_or_dash character that is a dot or a dash
*/
void flash_dot_or_dash(char dot_or_dash) {

  // Make the LED shine
  digitalWrite(led_pin, HIGH);
  tone(buzzer, 700);

  if (dot_or_dash == '.') { // If it is a dot
    delay(dot_duration);
  }
  else { // Has to be a dash...equal to three dots
    delay(dot_duration * 3);
  }

  // Turn the LED off
  digitalWrite(led_pin, LOW);
  noTone(buzzer);

  // Give space between parts of the same letter...equal to one dot
  delay(dot_duration);
}

I want the user to be able to customize that snippet of code to be able to transmit their callsign in morse code utilizing the strings already listed if possible.

Same thing with the random number.

The goal being the OTMK (One Time Morse Key) generation is for legal operators to have a somewhat random number generated, then when the button is pushed, to have it both transmitted via the pin 13 LED as well as over the buzzer where the operator is keying up their mic and broadcasting that tone sequence in morse.

Complicated enough lol? Thanks