Activating H-Bridge Motors

Hi guys, this is my first post here! I am building an autonomous pick and place robot using an Arduino UNO. I am currently trying to figure out how to activate the motors. We are using a perseids DIY Robot Smart Car Chassis Kit and a Qunqi L298N Motor Drive Controller Board Module Dual H Bridge DC Stepper powered by a 9V battery. I think we have everything connected properly, but I am having a hard time writing the code to get the motors turning. Here is what I have.

const int leftMotorForward = 7;
const int rightMotorForward = 6;

void setup()
{
  // Set L298N Control Pins as Output
  pinMode(rightMotorForward, OUTPUT);
  pinMode(leftMotorForward, OUTPUT);
}

void moveForward()    // Move Forward Function for Motor Driver.
{
    digitalWrite(rightMotorForward, HIGH);
    digitalWrite(leftMotorForward, HIGH);
}

If anybody has any suggestions, I would really appreciate the help. Thanks!

What kind of 9v battery?

One of these?
9v.jpg

If so, you should know that these are utterly useless for running motors.
For running smoke detectors that pull a very small current, they are OK.
But as soon as you try to pull the current that a motor pulls, they fail to maintain voltage.

Also, the l298 motor driver apparently uses ancient tech and drops significant voltage. Pololu has a decent selection of brushed motor drivers.

Please post the full code and schematic

As of now, this is the full code. We are only trying to get the motors to turn. I cannot get into the lab until tomorrow morning, but will post a picture then. Also there is another group in my lab working on the same project using a very similar setup. They are also using a 9V battery and theirs seems to be moving just fine?

I do not see your code. When you post it, please use code tags.
You confirm the voltage of your battery but not the type. Is it a 'smoke detector' battery like I have imaged in reply #1?

Yes, it is a smoke detector type battery. I used the code tags "(code)ALL MY CODE(/code)" (exact brackets instead of parenthesis) to display my code in the original post and it is appearing for me. Perhaps I am still doing something wrong though so here it is:

const int leftMotorForward = 7;
const int rightMotorForward = 6;

void setup()
{
// Set L298N Control Pins as Output
pinMode(rightMotorForward, OUTPUT);
pinMode(leftMotorForward, OUTPUT);
}

void moveForward() // Move Forward Function for Motor Driver.
{
digitalWrite(rightMotorForward, HIGH);
digitalWrite(leftMotorForward, HIGH);
}

Your "program" has no loop() function. So it will not compile. As it will not compile it will definitely not work.

Trying looking at some of the example programs in the IDE. You'll see they all have a common format. Your program should follow that format too.

Oh and unless your motors are really tiny that battery will not run them, not even for a few seconds.

Steve

Motor current is measured in amps, smoek detector current capability is 50mA or so before the voltage
starts to drop. Rechargable versions may fare better, but you will be better off with a battery intended
for powering motors, not one intended for powering smoke detectors and small radios.

Thanks for the help guys. There was a problem with both my schematic and my code, but I got the thing moving now!