Self Balancing Robot

I'm also using an MD23 for a self balancing robot - but I'm getting very strange behaviour. i can control the speed of the wheels but every 5 seconds it spins teh opposite way for a split second and then continues the correct way.

it also sometimes randomly stops one of the wheels.

is there any chance you can upload wire.h? I understand everything else and i think I may be going wrong with the actual iic interface.

Unless you maybe had this problem? I've tried in modes 2 and 3 and the same thing happens.

About the wheel spinning backward, if i had to guess i'll say it's some problem with signs in your code, possibly and overflow (ie a signed 16-bit int going over 32k or such). Try to debug the values you're using with Serial.print and see if you get near "limit" values when it happends.

wire.h should be included in arduino, i didn't wrote it.