Safety switch for machinery