Head scratcher with h bridge

As a next step in learning, you could probably squash all your if/else block into about ten lines with switch/case statements.

Reduce the repetition of code.
A simple move(direction) function would also help with that.