We propose an online algorithm for energy minimization of transmitting stations in IEEE 802.11 wireless local area networks (WLANs). Our algorithm configures radio frequency (RF) parameters such as the number of transmitting antennas based on the real-time traffic demand and channel condition so that the power consumption of the device is reduced, and the minimum data rate requirements of the stations at a target error rate are satisfied. The process of the transition between different RF configurations is investigated by employing a two-dimensional Markov chain model. Using an IEEE 802.11ac hardware testbed, we experimentally demonstrate that with our algorithm the power consumption of a transmitting station can be reduced upto 33%. We also validate that the experimental result and the simulation result obtained with our Markov model closely match.