I am building my self balancing robot with Arduino Ide. The process is good. The robot was trying to balance. And boom, it stopped. I dont know why, although when i use the 9v charger to plug in, the leds are still on. But it doesnt do anything anymore. In addition to this, i have a problem. That is the robot doesnt work as I code after around 30s to 1 min. I guess it is about memory problem. When I tried to reduce the data used by variables, it seem better but it still stopped follow my code after 1 min. My code simply is, if the gyro of y >0 or <O , I will move my encoder motors forward or backward. At the beginning, the robot functioned correctly, then after that it just moved encoders in one way and total
Y forgot about gyro sensor part. Thank you so much in advance!
Mega Pi stops working
Hi metou3,
Do you upload your own program to the balancing robot?
Please reset default program for the Ultimate robot and control it with Makeblock APP refer to this instructions have a try.
For the other issue that robot doesn’t repeat the action after 1 min, do you program with mBlock software or Makeblock APP, you may attach your program directly.
If you have rechargeable lithium batteries (7.4v is ok), please kindly try it either.
Hi,
I am using the charger with 9V. And, I use mBlock software to generate Arduino code. Then I come to Arduino IDE to change as I want. But anyway, the result will be the same as mBlock. Only when I reduce the data type, for example, instead of double or int, I used byte, it leads to better result. I mean longer time, but it still finally stopped working correctly. For example, the serial monitor stops, this time my robot starts to work wrongly. Can you give me a solution or why?
Addition to this, I have another problem, my Gyro seems doesnt work now. Before it worked well. At the moment, when I printed with Serial print, it gives me only 0 for x,y,z axis.
Hi metou3,
The default program for the self-balance robot has been integrated in the mBlock. Does it work when you just reset default program for MegaPi on mBlock, then control with Makeblock APP? Instruction about resetting default program for MegaPi:How to reset default program for MegaPi.zip (363.1 KB)
If you wrote your own program, we can’t tell if the issue is on the robot or on the Program.
As for testing if the gyro is working or not, please refer to this document.The example program to test if the 3 axis accelorometer and gyro is working properly.zip (2.0 MB)