How to change direction of motors in software