The invention firstly provides a control method of a washing
machine. A distance measuring sensor and an electric cover are arranged at a door body of the washing
machine; the controller controls the electric cover to be opened before or while controlling the water
inlet valve to feed water into the washing cavity according to a washing program, so that the distance measuring sensor is exposed; the distance measuring sensor detects the real-time flatness of the load surface in the water inlet process, when the detected real-time flatness is smaller than or equal to a preset value, it is regarded that water inlet meets the washing requirement, and water inlet is controlled to be stopped. The invention further provides a washing
machine. According to the control method of the washing machine and the washing machine, it is not needed to determine the
water consumption according to the weight of the to-be-washed clothes, the data detected by the distance measuring sensor is compared with the preset data to accurately control the water inlet process and reduce water and
electricity consumption, the electric cover is arranged, foam is prevented from being attached to the distance measuring sensor, and the
water consumption is reduced. The water inlet control precision is influenced.