I believe this book is for middle grade and from the 1970s or before. It is about a boy who spends the summer away from home, near the ocean or on an island. The first night there, he see someone using Morse code to spell out his name. Later, he learns it is another boy who wants to be friends. (They become friends.) There is some type of mystery to be solved and a man (maybe a relative?) tries to kill the boy at the end of the book. There are caves or some kind of natural phenomenon where at the right tide, the wind/water rushes through, sounding like ghosts moaning. When the man is after him, the boy has to face his fear and enter the caves to escape.