Arduino SOS builtin led loop with latched button

So I have run out of ideas. I am relatively new to this and am trying to combine two codes. The first is the blinking SOS the second is the latching button and the third is my attempt(filled with problems most likely basically guessing) The problem with my attempt is currently it will stay off if i press the button it will blink one SOS and wont loop. I need it to loop until i press the button then stop and start again if i press it after. However instead of the latched button turning on an led then turning it off when its pressed then back on when pressed again. I need it to do this with blinking SOS. So to clarify, I need to press the button to start the SOS then if i press it again it has to stop, then if i press again it will start again and so forth.

SOS.ino (862 Bytes)

Push_Button_Latched_Switch.ino (554 Bytes)

SOS_Switch_Test.ino (1.17 KB)

This is the SOS.ino

int dot = 500;
int dash = dot * 3;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);

}
void loop() {
  morseS();
  morseO();
  morseS();
}

void morseS() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dot);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dot);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dot);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dash);
}

void morseO() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dash);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dash);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dash);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dash);
}

This is the Push_Button_Latched_Switch.ino

#define buttonPin 2

int ledState = LOW;
int lastButtonState = LOW;
int buttonState = LOW;

void setup() {
  // put your setup code here, to run once:
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(buttonPin, INPUT);
  digitalWrite(LED_BUILTIN, ledState);
}

void loop() {
  // put your main code here, to run repeatedly:
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH && lastButtonState == LOW)
  {
    ledState = !ledState;
  }
  lastButtonState = buttonState;
  digitalWrite(LED_BUILTIN, ledState);
  delay(3);
}

This is my attempt Both work fine seperately however me combining them is where the problem comes in

#define buttonPin 2

int ledState = LOW;
int lastButtonState = LOW;
int buttonState = LOW;
int dot = 100;
int dash = dot * 3;


void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(buttonPin, INPUT);
  digitalWrite(LED_BUILTIN, ledState);
}

void loop() {

  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH && lastButtonState == LOW)
  {
    ledState = !ledState;
    SOS();
  }
  lastButtonState = buttonState;
  delay(3);
    
}

void SOS()   {
  morseS();
  morseO();
  morseS();

}

void morseS() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dot);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dot);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dot);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dash);
}

void morseO() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dash);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dash);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dot);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(dash);
  digitalWrite(LED_BUILTIN, LOW);
  delay(dash);
}