rc receiver programming help

Hi guys, i been following examples from the internet regarding using rc receiver and arduino. so far for hardward wise no issue but come to the software side i been facing problem. below is the program for it.
i am using L298N with Uno to control 4 motors. (2 each in parallel on each side of the motor controller.)
the motors are not running even after i got the nos. with the rc transmitter
any advise is greatly appreciated.

int enA = 10;// L298N pin 7 to Arduino pin 10 ~
int in1 = 9;// L298N pin 8 to Arduino pin 9 ~
int in2 = 8;// L198N pin 9 to Arduino pin 8 

int enB = 5;//L298N pin 12 to Arduino pin 5 ~
int in3 = 6;//L298N pin 10 to Arduino pin 6 ~
int in4 = 7;// L298N pin 11 to Arduino pin 7 

int ch2 = 3; //Arduino pin 3 to RC receiver channel 2
int ch4 = 11; //Arduino pin 11 to RC receiver channel 4

void setup() {

pinMode (enA, OUTPUT);
pinMode (enB, OUTPUT);
pinMode (in1, OUTPUT);
pinMode (in2, OUTPUT);
pinMode (in3, OUTPUT);
pinMode (in4, OUTPUT);

pinMode (ch2, INPUT);
pinMode (ch4, INPUT);
Serial.begin (9600); 
}
void loop() {
ch2 = pulseIn (ch2, HIGH); 
Serial.println (ch2); 
if (ch2 > 1200 && ch2 < 2000) 
{
digitalWrite (in1, LOW);
digitalWrite (in2, LOW);
}
if (ch2 < 1200)
{
digitalWrite (9, HIGH); 
digitalWrite (8, LOW);
}
if (ch2 >2100)
{
digitalWrite (9, LOW);
digitalWrite (8, HIGH); 
}
ch4 = pulseIn (ch4, HIGH); 
Serial.println (ch4); 
if (ch4 > 1100 && ch4 < 1900) 
{
digitalWrite (in3, LOW);
digitalWrite (in4, LOW);
}
if (ch4 < 1100)
{
digitalWrite (6, LOW);
digitalWrite (7, LOW); 
}
if (ch4 > 1900) 
{
digitalWrite (6, HIGH); 
digitalWrite (7, HIGH); 
}}

Welcome to the Forum. Please read these two posts:

How to use this forum - please read.
and
Read this before posting a programming question ...

You have posted code without using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don't do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons.
If you have already posted without using code tags, open your message and select "modify" from the pull down menu labelled, "More", at the lower left corner of the message. Highlight your code by selecting it (it turns blue), and then click on the "</>" icon at the upper left hand corner. Click on the "Save" button. Code tags can also be inserted manually in the forum text using the code and /code metatags.

Unless the sketch is too large, it's better if you post your code, rather than attach it. When it's attached, we have to download it, create a folder then open your code in our IDE. And afterwards, the folder remains unless we navigate to the "Temp" folder and manually remove it. It's much easier to just view the code in your post.

Many questions can be answered by reading the documentation which is provided with the IDE, available under the help tab, or online here.

There are many other things that programmers do to make their code understandable. Please do them, as a courtesy to the members who volunteer their time to help you here. One is to use a standard indentation to clearly show the code blocks. Never put more than one statement per line. Place any brackets by themselves on a separate line. Before posting the code, use Ctrl-T in the IDE to reformat the code in a standard format, which makes it easier for us to read.

sorry about that, i have already coded the program. hope it helps. do advise if otherwise.

pinMode (in1, OUTPUT);
pinMode (in2, OUTPUT);
pinMode (in3, OUTPUT);
pinMode (in4, OUTPUT);

Do those 4 lines make sense to you? They do NOT make sense to me.

There are two pins, apparently, that control direction, for each motor. There is one pin that controls speed, for each motor.

Please show the lines that set the speed for each motor.

ch4 = pulseIn (ch4, HIGH);

I don't imagine that's going to go well after the first time you call it.
(Another good reason to make your pin numbers "const")

these 4 lines are suppose to define input 1 to input 4 as OUTPUT pins which control the direction of the motors whereas enA is suppose to define the speed?

the line below are suppose to determine the speed.

digitalWrite (9, HIGH);
digitalWrite (8, LOW);

please advise if i am wrong.

PaulS:

pinMode (in1, OUTPUT);

pinMode (in2, OUTPUT);
pinMode (in3, OUTPUT);
pinMode (in4, OUTPUT);



Do those 4 lines make sense to you? They do NOT make sense to me.

There are two pins, apparently, that control direction, for each motor. There is one pin that controls speed, for each motor.

Please show the lines that set the speed for each motor.

yeah man, so how do i use "const' in this case? appreciate your advise.

AWOL:

ch4 = pulseIn (ch4, HIGH);

I don't imagine that's going to go well after the first time you call it.
(Another good reason to make your pin numbers "const")

these 4 lines are suppose to define input 1 to input 4 as OUTPUT pins

That's horseshit, and you know it. Input1 to input4 are NOT output.

The names of the pins on the motor driver don't mean shit. Give the pin ON THE ARDUINO a reasonable name. input1 is NOT a reasonable name when it is not the name of an input!

terrance72sg:
yeah man, so how do i use "const' in this case? appreciate your advise.

It doesn't really matter whether or not you use const, just so long as you don't try to store the pulse length
a) to the wrong-sized variable
b) to the wrong-sized variable you happen to be using to address the pin.

If you use a const to name the pin, the compiler would've thrown a wobbly when you tried to assign a value to it.