Motorcontrol code working with reflective sensor