[Why no help?] Controlling Motors with PWM and Joystick (Potential RC car)

Hey everyone!

I'm currently working on a RC car project, it's in its earliest stages and I'm being held back by what I believe to be a simple issue.

Attached I have a fritzing image of my current circuit,I have 2 DC motors wired to a L293D IC which is then in turn wired to the arduino with a joystick too. I'm trying to control the motors with the joystick, I get that I can do it simply : If >600 pin 6 high etc. to simply steer and choose direction but I don't understand how to write a sketch for PWM to control it to accelerate depending on how far the joystick is pushed? Or even how to declare the analogue pins as a few people have done it differently.

Any help would be greatly appreciated and i intend to use nrf24lo1 modules when i get them to extend the range if that will effect this now in any way?

Current sketch:

const int mainForward = 6;
const int mainBackward = 9;
const int steerLeft = 10;
const int steerRight = 11;

void setup()
{
pinMode(mainForward , OUTPUT);
pinMode(mainBackward , OUTPUT);
pinMode(steerLeft , OUTPUT);
pinMode(steerRight , OUTPUT);
}
void loop()
{
//go forward
digitalWrite(mainForward , HIGH);
digitalWrite(mainBackward , LOW);
digitalWrite(steerLeft , LOW);
digitalWrite(steerRight , LOW);
delay(1500);

//go backward for 5sec
digitalWrite(mainForward , LOW);
digitalWrite(mainBackward , HIGH);
digitalWrite(steerLeft , LOW);
digitalWrite(steerRight , LOW);
delay(1500);

//go Left for 5sec
digitalWrite(mainForward , LOW);
digitalWrite(mainBackward , LOW);
digitalWrite(steerLeft , HIGH);
digitalWrite(steerRight , LOW);
delay(1500);

//go Right for 5sec
digitalWrite(mainForward , LOW);
digitalWrite(mainBackward , LOW);
digitalWrite(steerLeft , LOW);
digitalWrite(steerRight , HIGH);
delay(1500);

//Stop for 5sec
digitalWrite(mainForward , LOW);
digitalWrite(mainBackward , LOW);
digitalWrite(steerLeft , LOW);
digitalWrite(steerRight , LOW);
delay(1500);

}

Please do not double post.

The best help that I can give is to recommend the simple rf24 tutorial by Robin2. It will show how to set up the radios and send and receive multiple data items.

Read the how to use this forum-please read stickies to see how to properly post code and get the most from the forum.

groundFungus:
The best help that I can give is to recommend the simple rf24 tutorial by Robin2. It will show how to set up the radios and send and receive multiple data items.

Read the how to use this forum-please read stickies to see how to properly post code and get the most from the forum.

Thank you for your reply, my only issue is that the tutorial I followed uses the Radiohead library, where as that post uses the TMRh20 library and I didn’t know if having both libraries on my pc would be conflicting? If so Would it be worth 1. deleting RH Library and starting from scratch following the “guide” provided with the TMRh20 lib or 2. Possibly find a similar “guide” with the RH library in mind? Thanks again for the reply.

With reference to the “use this forum” part of the comment I have a previously but when it came to mobile indidmt see any insert code like I have on pc. Sorry if it’s that big of an issue

jremington:
Please do not double post.

Didn’t realise I did?

Both of my posts refer to 2 motors with a driver and joystick but that’s the only similarity as the problems are different.

LyrikalDevil:
Didn’t realise I did?

Both of my posts refer to 2 motors with a driver and joystick but that’s the only similarity as the problems are different.

It is much easier if you stick to one Thread for one project.

I am not going to waste my time reading two Threads to make sure I am not duplicating or contradicting someone else's advice.

Ciick Report to Moderator and ask to have the Threads merged.

...R

Robin2:
It is much easier if you stick to one Thread for one project.

I am not going to waste my time reading two Threads to make sure I am not duplicating or contradicting someone else's advice.

Ciick Report to Moderator and ask to have the Threads merged.

...R

They’re 2 completely different projects only some hardware is similar (not shared), One is wired the other is wireless I don’t see how they’re the same project when they’re different devices all together with there own dedicated hardware that I’m using.

LyrikalDevil:
They’re 2 completely different projects only some hardware is similar (not shared), One is wired the other is wireless I don’t see how they’re the same project when they’re different devices all together with there own dedicated hardware that I’m using.

In that case I withdraw my objections. However I think you will agree that it was easy to imagine that they were aspects of a single project.

This one starts with

I'm currently working on a RC car project,

and the other one starts with

I am a beginner and I have code (from followed tutorial with unhelpful writer) for an rc car

...R

Robin2:
In that case I withdraw my objections. However I think you will agree that it was easy to imagine that they were aspects of a single project.

This one starts withand the other one starts with
...R

Thank you for the honest reply and info agree with you too I can see how it would be easy to assume that they were the same project, I thought I made it clear (2:30am) but I can see how I didn’t wen I logged in this morning. Thank you for your help