The scope of this research is to control a balancing robot in real time mode. This problem is solved with the help of a neural network, which is trained online and used as a controller. A method to develop such controller is proposed. Particularly, the neural network structure is chosen, restrictions is developed to determine situations when to train the network online, an algorithm is proposed to define the sign of change in the network weights. The obtained controller is compared to a linearly quadratic regulator (LQR) using a real balancing robot on LEGO EV3 platform. Experiments are conducted in two modes. The first of them is to keep the robot at an unstable equilibrium mode. The second one is both to make the robot follow the user's setpoint for the state coordinates and stabilize the plant. The obtained results show that the control quality is improved comparing to the LQR controller, since the system with the neural network is able to adapt to real conditions of the experiments. As far as the first type of experiments is concerned, the robot controlled by the network has covered the distance, which is by 1630 radians shorter comparing to the LQR controller.