Code for several iterations of a self-balancing robot