Line following robot- confuse in which direction the robots is going IRL

Hello everyone!

I currently confused in which direction is going in real life. Bellow I set the 2 dc motor to turn clockwise. I also add how I setup the arduino.

const int motorPin1 = 5;
const int motorPin2 = 6;
const int motorPin3 = 10;
const int motorPin4 = 9;

void setup()
{
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
}

void loop()
{
  //Turns both motor clockwise direction
  digitalWrite(motorPin1, HIGH);
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, HIGH);
}

Imagine that we don't know anything about your robot or your problem

Now, try again.

Hi,
Welcome to the forum and thanks for putting your code in code tags.
OPs image.


If your motors are either side of a chassis, then for forward motion, one motor will rotate clockwise and the other counter-clockwise because it is on the other side.

What are you using as a power source, a proper circuit diagram other than a Fritzy diagram would be prefered.

Tom.. :slight_smile:

Thanks for the help. Normally, I'll be using a 9v battery to power the 2 DC motor and another one to power the arduino uno. On tinkercad, it automatically powered the arduino wth the power code even if you use Vin on the card. Sorry I do not know how to draw circuit diagram, I'm just a newbie doing a small robot.

TheMemberFormerlyKnownAsAWOL:
Imagine that we don't know anything about your robot or your problem

Now, try again.

The project I'm doing is a small line following robots. Two wheels will be turn using two 6V DC motor, https://www.arduino.cc/documents/datasheets/DCmotor.PDF . And these two motor will be powered with a 9V battery. Another 9V battery will be used to power the arduino alone.
For know I'm writing the code to let the robots to move forward, but since on tinkercad it is in a 2D diagram, I'm confuse whether in real life the way I coded it, will it move forward.
My question is, how I coded it, will it move forward? Since I do not have the arduino kit in real life, I can't test it IRL.

. And these two motor will be powered with a 9V battery.

.. but not for very long

TheMemberFormerlyKnownAsAWOL:
.. but not for very long

why? The battery is not enough?

What is the mAh rating of your battery at load for your motors?
(Remember you're wasting 3V getting 9V down to 6V)

TheMemberFormerlyKnownAsAWOL:
What is the mAh rating of your battery at load for your motors?
(Remember you're wasting 3V getting 9V down to 6V)

It says that the 9V battery Amp-Hours at 100 mA Discharge rate is 310 mAH. I'm using normal 9v duracell batteries for the project.

Those teeny vibra motors in a mobile phone can draw 100mA.
What do your motors draw?

TheMemberFormerlyKnownAsAWOL:
Those teeny vibra motors in a mobile phone can draw 100mA.
What do your motors draw?

Here the link to the datasheet: https://www.arduino.cc/documents/datasheets/DCmotor.PDF

It says :

No Load Current:90mA (120mA max)

I didn't ask for the no-load current, because it seems to me that your motor will be loaded.

TheMemberFormerlyKnownAsAWOL:
I didn't ask for the no-load current, because it seems to me that your motor will be loaded.

In the datasheet, it is not specify. It just say these infos:

Operating voltage: 6.0V DC
1、No Load Speed:7500±10%rpm
2、No Load Current:90mA (120mA max)
3、30g. cm Load Speed:6100rpm
4、Stall Torque:150g. cm min
5、Stall Current:2.6A (3.2A MAX)

Do you have a multimeter? You could measure the loaded current.