balanced gray code on arduino