It seems the answer lies in Public Law 99-344 which became law on July 7, 1976. It states in part:
“(18) by striking out section 6 and inserting in lieu therof the following: “SEC. 6. During rendition of the national anthem when the flag is displayed, all present except those in uniform should stand at attention facing the flag with the right hand over the heart....””
Hand over the heart was not required until 1976. Obama and others like me were taught hand over heart for pledge and no hand over heart for anthem. Obama, it seems, was just going with what he had been correctly taught many years ago.
Since then it is a requirement.