valve operating apparatus is disclosed in which intake or exhaust valves of an internal combustion engine are operated by rocker arms driven by cams having different cam profiles and hydraulically operated coupling mechanisms for selectively connecting or disconnecting adjacent rocker arms to vary the operation of the valves under different engine operating conditions . sensing means in the form of a piston displacement detecting device is included in the apparatus to monitor its operating condition .