Hello guys, I have a final project for my college. And my lecturer wants me to build a line follower with self balancing robot. And now, I already build it, but still have a problem with the c code.
I already build the robot, and I used:
Arduino UNO
Dual H Bridge Motor Shield
Motor DC 3V
FC - 51 IR sensor
MPU-6050 Gyro
I already tried line follower and self balancing program that I found on internet, but I can't merge it.
I tried to merge them, but the self balancing still doesn't work. If I upload just line follower or just self balancing program, it works. So the problem is, I still cannot merge the program.
Maybe someone can help me ;D
PaulS:
Not if you don't show your attempt to merge the code AND explain what happens when the code runs.
Okay then. but first, just want you to know that I don't really understand about c code.
So I simply make the same define for each program, and merge the void_setup and void_loop.
and the result was the line follower is more dominant than the balancing.
I really want to make the robot will follow the line WHEN the robot is balance, and when the robot is not balance, the robot will balance it self. But I can't make the c code logic.
I realize that the the balancing use the void_moveBackForth. So, I tried to make the line follower using void_linefollower with loopAt6Hz >=6000, long time6Hz= 0;
and still no result.
PaulS:
I can't imagine, then, how you are going to claim any credit for the resulting program.
Is the class for assembling a robot from a kit?
Or is this supposed to be a robot of YOUR own design, running YOUR code?
PaulS:
I can't imagine, then, how you are going to claim any credit for the resulting program.
Is the class for assembling a robot from a kit?
Or is this supposed to be a robot of YOUR own design, running YOUR code?
I mean not serious final project actually, because this class never actually learn about c code. So I just find the code from internet, and I will write the credits from where I took the c code. But at least, I'm trying to understand how the c code works. By finding the program and change the program for my robot.
So I simply make the same define for each program, and merge the void_setup and void_loop.
and the result was the line follower is more dominant than the balancing.
This shouldn't be too surprising. As you have the balancing code at the top of loop(), where the pid output is used to drive the motors, then at the bottom of the loop, you have the line follower code using the same pins and motors overwriting those value.
I can't imagine, then, how you are going to claim any credit for the resulting program.
I am in complete agreement with PaulS here. So I'm not going to offer any code. I will give a a few tips though:
You want to prioritise balance, after all, with no balance, your robot will fall over and there will be no line following.
Balance is always on going, so you have to decide where your robot needs to head to follow the line, and be able to fall back on the balancing if the gyros indicate you might be falling over.
arsalarizki:
I mean not serious final project actually, because this class never actually learn about c code.
So what project is this?
What level? Tertiary?
They expect you to manage self balancing and line following without implying that you need to understand some kind of code? Or what 'code' did they teach you?
You already built it ??
tammytam:
This shouldn't be too surprising. As you have the balancing code at the top of loop(), where the pid output is used to drive the motors, then at the bottom of the loop, you have the line follower code using the same pins and motors overwriting those value.
I am in complete agreement with PaulS here. So I'm not going to offer any code. I will give a a few tips though:
You want to prioritise balance, after all, with no balance, your robot will fall over and there will be no line following.
Balance is always on going, so you have to decide where your robot needs to head to follow the line, and be able to fall back on the balancing if the gyros indicate you might be falling over.
Yes sure, Tips is enough.
and btw, how I can arrange the priorities of the command?
I already arrange if the robot is balance, then the line follower should be work.
but the line follower always on and the balance not..
1:1:
So what project is this?
What level? Tertiary?
They expect you to manage self balancing and line following without implying that you need to understand some kind of code? Or what 'code' did they teach you?
You already built it ??
This is class project, not tertiary.
I did said that the class never learn about single c code or else.
I don't really understand c code doesn't mean I don't understand at all right?
And yes, I already built my robot. with the tutorial that I found in internet.