Hi guys,
Really need some help/advice here. I built a 2 wheels self-balancing robot. The hardware is done as attached. The only problem is to make it balance. I loaded the code in Arduino 101 (As attached), with the correct initial position, it will be able to balance for a while and then keep moving forward and fall off. I aint sure how to make it just move within the range where it can balance itself. It always seems to me it will move forward /backward whenever out of the range.
Can anyone help to look whats wrong with my code ?
Thanks and appreciate
Genuino101BalacingRobot.zip (4.46 KB)