added dynamic sleep function
Added function to set motor direction via 595 shiftregister.

Fixed minor error in correct_pwm().