Gear indicator

Could be a hardware problem or a software problem.

Please modify your post. Select all the code, press the icon with the # on it to put tags around the code, and save the changes.

Adding the serial output that you see would help narrow down the hardware/software issue, as would knowing whether oldloop() displayed correct output.