The embodiment of the invention provides a code scanning method which is applied to
electronic equipment, the
electronic equipment comprises a distance measuring module and a
camera module, and the method comprises the following steps: after a first operation of a user is received, the
electronic equipment starts a code scanning application in response to the first operation. And the electronic device receives a second operation of the user on the code scanning application, starts the
camera module in response to the second operation, and controls the
distance measurement module to measure the distance between the electronic device and the target
barcode. Based on the distance between the electronic device and the target bar code, target movement parameters of the
camera module are determined, and the target movement parameters comprise a target
focal length when the camera module recognizes the target bar code and a target movement position of a motor located in the camera module when the camera module recognizes the target bar code. And identifying the target bar code based on the target movement parameter. According to the invention, the distance measuring module can be controlled in parallel to measure distance while the camera module is started, so that the time for the camera module to
shoot the target bar code to focus and
zoom is shortened, and the code scanning efficiency is improved.