Evidently I'm very into providing helpful scripts on here recently, and this one is no exception.
The Raspberry Pi Zero W has a miniHDMI port for a monitor, but if you lack such a cable and want to use it for a headless IOT product, you'll need its IP or hostname to
ssh into it. My school network blocks addressing devices by hostname (
ssh firstname.lastname@example.org fails to locate my pi on the network) and I can't access the router configuration to see the IP of a newly-connected device. I'm out of luck without a monitor to see its IP address once it connects to the network...but the Pi Zero does have one built-in user interface device – a single onboard LED.
So, without further ado, here's a bash script to signal the Pi Zero's IP in morse code every time you boot it up.
See detailed instructions and the startup invocation for this script at the Github Repository.