fixes direction change in arduino code