In order to get stable and orderly road traffic flow, the speed controller is designed based on the discrete approaching law. By considering the uncertain of traffic flow arising from the inflow and outflow of the ramp, the disturbance compensator is designed. The density of each section is the control objective. Firstly, the target speed is obtained through discrete reaching law of density function. Then the speed controller is used, which makes the speed equal to the target speed in limited steps. The density is stabilized within certain range finally if the parameters satisfy certain conditions, and the algorithm steps and proof are given. The simulation results show that the speed controller stabilizes the density of the section with ramp around specified value, and the density of the section without ramp tends to specified value, thus road congestion is avoided.