There’s method in a firefly’s flashes
The light signals can be a mating call or a way to ward off predators

FLASH DANCE Fireflies use their tail lights for mating. New evidence suggests that the flashing may also warn off nocturnal predators.
Dr. Stephen Marshall