Head scratcher with h bridge

Proper use of code tags on your first post!
Karma++

I see that you have a debugging statement in there. Do you get it on the serial monitor on the first execution where the motor mysteriously does not reverse?