This arduino code is a bit more complicated, but I'll explain it as easy as possible. At the beginning we declare the variables, then in the setup we add the port and if it is analog. Now comes the difficult function Loop, where we have to put digitalWrite for the LED, tone for the speaker and delay for the duration of lighting the LED, in my case this depends on the letters of my name written in morse code, and the same form the tone. I hope you serve, below I leave the video.