Position sensor for a mechanical device provided with a first mechanical member and with a second mechanical member, which is susceptible of relative motion with respect to said first mechanical member and is provided with a positioning track provided at least with first optical sections and with second optical sections having different optical contrast with respect to said first optical sections, said position sensor comprising: - at least one optical emitter, which is arranged for projecting, on the positioning track of said second mechanical member, an incident radiation adapted to irradiate a projection zone on said positioning track; - at least one optical detector, which is arranged for detecting a reflected radiation coming from said projection zone hit by said incident radiation, and for generating a corresponding measurement signal; - an electronic processing unit, which is operatively connected to said optical detector in order to receive said measurement signal and is arranged for: - calculating, on the basis of said measurement signal, a reflectance value indicative of the reflectivity of the projection zone on said positioning track; - comparing said reflectance value with at least one discrimination value, which identifies at least one first reflectance interval, adapted to be associated with said first optical sections, and a second reflectance interval, adapted to be associated with said second optical sections; - with said reflectance value in said first reflectance interval, generating a first identification parameter associated with said first optical sections, and, with said reflectance value in said second reflectance interval, generating a second identification parameter associated with said second optical sections; - generating, as a function of said identification parameters (ID1, ID2), a position signal; said position sensor being characterized in that it comprises at least one signaling module operatively associated with said electronic processing unit, which is arranged for controlling said signaling module to send a warning signal as a function of said reflectance value; wherein said electronic processing unit, with said reflectance value within said first reflectance interval, is configured for: - comparing said reflectance value with at least one first deviation value, which identifies at least two first state intervals (IS 1), and - controlling said signaling module to emit a corresponding said warning signal as a function of the position of said reflectance value with respect to said first state intervals. - at least one optical emitter, which is arranged for projecting, on the positioning track of said second mechanical member, an incident radiation adapted to irradiate a projection zone on said positioning track; - at least one optical detector, which is arranged for detecting a reflected radiation coming from said projection zone hit by said incident radiation, and for generating a corresponding measurement signal; - an electronic processing unit, which is operatively connected to said optical detector in order to receive said measurement signal and is arranged for: - calculating, on the basis of said measurement signal, a reflectance value indicative of the reflectivity of the projection zone on said positioning track; - comparing said reflectance value with at least one discrimination value, which identifies at least one first reflectance interval, adapted to be associated with said first optical sections, and a second reflectance interval, adapted to be associated with said second optical sections; - with said reflectance value in said first reflectance interval, generating a first identification parameter associated with said first optical sections, and, with said reflectance value in said second reflectance interval, generating a second identification parameter associated with said second optical sections; - generating, as a function of said identification parameters (ID1, ID2), a position signal; - calculating, on the basis of said measurement signal, a reflectance value indicative of the reflectivity of the projection zone on said positioning track; - comparing said reflectance value with at least one discrimination value, which identifies at least one first reflectance interval, adapted to be associated with said first optical sections, and a second reflectance interval, adapted to be associated with said second optical sections; - with said reflectance value in said first reflectance interval, generating a first identification parameter associated with said first optical sections, and, with said reflectance value in said second reflectance interval, generating a second identification parameter associated with said second optical sections; - generating, as a function of said identification parameters (ID1, ID2), a position signal; - comparing said reflectance value with at least one first deviation value, which identifies at least two first state intervals (IS 1), and - controlling said signaling module to emit a corresponding said warning signal as a function of the position of said reflectance value with respect to said first state intervals.