The explosive growth of connected mobile devices in Edge of Things (EoT) computing offers an opportunity to support high-quality life in smart cities but also results in an extremely high energy consumption in battery limited mobile devices. Accordingly, to increase the battery life or improve performance of mobile devices, code offloading has been proposed. Moreover, with the development of the technology about low-latency and low-power of device-to-device communication, offloading codes to surrounding mobile devices in nearby cloudlets has been widely applied. However, the existing works on the mobile cloudlets mostly focus on code distribution and scheduling but ignores the affection of the energy efficiency of CPU. According to the CPU Energy/Frequency Convexity Rule, there is an optimal clock frequency that can minimize energy consumption. In recent years, a novel processor architectures with adjustable frequency have been proposed to deliver various kinds of energy efficiency and CPU performance. Taking the processor frequency into consideration, we propose an energy-efficient code offloading framework as MilDip to offload partitioned heavy tasks to around mobile devices and to operate these tasks in the state of low CPU performance and high energy efficiency. We formulate offloading problem as a mixed-integer nonlinear optimization problem, with the goal of energy efficiency maximization. Based on the formulation, we further propose a heuristic algorithm COFS based on CPU frequency scaling. Extensive simulated experiments are provided to evaluate the performance of our method. The simulation results show that up to 77% of energy can be saved by using COFS compared to the local execution. Moreover, when enough devices surround the terminal, COFS energy consumption tends to stabilize. From the experiments, we can also conclude that COFS can save more about 20% ~ 50% energy consumption comparing to other schemes.