A data transmission method applied to an electronic device with a BLUETOOTH function, comprising: establishing a BLUETOOTH connection with a BLUETOOTH device; wherein the data transmission method further comprises: creating and initializing a first rate parameter, a second rate parameter, a first connection interval parameter, and a second connection interval parameter, wherein the first rate parameter is used to record a maximum transmission rate, and the second rate parameter is used to indicate an average transmission rate in a data transmission process; the first connection interval parameter is used to record a connection interval relating to the first rate parameter, and the second connection interval parameter is used to dynamically adjust a connection interval used in the data transmission process; based on the second connection interval parameter, performing data transmission with the BLUETOOTH device within a preset time length, and updating the second rate parameter through the average transmission rate within the time length; comparing the first rate parameter with the second rate parameter; if the first rate parameter is less than the second rate parameter, updating the first rate parameter, the first connection interval parameter, and the second connection interval parameter, and returning to execute the step of performing the data transmission with the BLUETOOTH device within the preset time length, and updating the second rate parameter through the average transmission rate within the time length based on the second connection interval parameter; and if the first rate parameter is greater than or equal to the second rate parameter, maintaining the BLUETOOTH connection with the BLUETOOTH device based on the first connection interval parameter. establishing a BLUETOOTH connection with a BLUETOOTH device; wherein the data transmission method further comprises: creating and initializing a first rate parameter, a second rate parameter, a first connection interval parameter, and a second connection interval parameter, wherein the first rate parameter is used to record a maximum transmission rate, and the second rate parameter is used to indicate an average transmission rate in a data transmission process; the first connection interval parameter is used to record a connection interval relating to the first rate parameter, and the second connection interval parameter is used to dynamically adjust a connection interval used in the data transmission process; based on the second connection interval parameter, performing data transmission with the BLUETOOTH device within a preset time length, and updating the second rate parameter through the average transmission rate within the time length; comparing the first rate parameter with the second rate parameter; if the first rate parameter is less than the second rate parameter, updating the first rate parameter, the first connection interval parameter, and the second connection interval parameter, and returning to execute the step of performing the data transmission with the BLUETOOTH device within the preset time length, and updating the second rate parameter through the average transmission rate within the time length based on the second connection interval parameter; and if the first rate parameter is greater than or equal to the second rate parameter, maintaining the BLUETOOTH connection with the BLUETOOTH device based on the first connection interval parameter. creating and initializing a first rate parameter, a second rate parameter, a first connection interval parameter, and a second connection interval parameter, wherein the first rate parameter is used to record a maximum transmission rate, and the second rate parameter is used to indicate an average transmission rate in a data transmission process; the first connection interval parameter is used to record a connection interval relating to the first rate parameter, and the second connection interval parameter is used to dynamically adjust a connection interval used in the data transmission process; based on the second connection interval parameter, performing data transmission with the BLUETOOTH device within a preset time length, and updating the second rate parameter through the average transmission rate within the time length; comparing the first rate parameter with the second rate parameter; if the first rate parameter is less than the second rate parameter, updating the first rate parameter, the first connection interval parameter, and the second connection interval parameter, and returning to execute the step of performing the data transmission with the BLUETOOTH device within the preset time length, and updating the second rate parameter through the average transmission rate within the time length based on the second connection interval parameter; and if the first rate parameter is greater than or equal to the second rate parameter, maintaining the BLUETOOTH connection with the BLUETOOTH device based on the first connection interval parameter.