Arduino code for an optical encoder