Simple sensor

Would someone help me with the program?