Hoverboard motor control

Need help controlling 2 brushless motors from hoverboards with arduino uno. Im using an esc that accepts 0-5v for speed control. And a generic rc transmitter and receiver. I found this code and it works but id like to adapt it to control 2 motors/2 esc's.

const int CH_1_PIN=11; 
const int deadzone =20; 
double x,y;
int VRsignal = 5; 
void setup(){
  pinMode(VRsignal, OUTPUT);
  Serial.begin(9600); 
}
void loop(){
  x = pulseIn(11,HIGH);
  y = pulseToPWM(x);
analogWrite(VRsignal, y);
  int ch_1 = pulseIn(CH_1_PIN, HIGH,25000);
  Serial.println(pulseToPWM(ch_1));
  delay(5); }
//convert rc pulse value to motor PWM value
int pulseToPWM(int pulse){
  if (pulse>1000){
    pulse = map(pulse,1000,2000,-500,500);
    pulse= constrain(pulse,-255,255);
    }else{
      pulse=0;
      }
  if (abs(pulse)<= deadzone){
        pulse=0;
        }
        return pulse; }

Please edit your post to add code tags.

But before posting, use the CRTL-T autoformat in the Arduino IDE to make the code structure clear.

Please post links to the ESCs and motors, and explain how the code should control them.

Nothing wrong with that. Can be a clever way to start. What is Your coding experience?
Good so far that the code works for one motor. What would the difference be between the running of 2 motors?
Let the 2 ESCs share the same controller signals and both motors will run.

My only experience is watching Paul McWhorter on youtube and doing the first few projects from the Elegoo starter kit. My reasoning for wanting to control the motors separately is that id like some degree of steering. Also, the esc only has one input for the motor hall sensors. This is the esc im using.

Not much information on the product page for that motor controller.

It uses 0 to 5v to control the speed.

The Arduino does not have a DAC, it outputs 5V pulses with variable duty cycle. If it works for you, fine.

It does work.

Im aware. If you dont know how to adapt the code to control 2 motors you can just say so.

Use two analogWrite() channels to control two motors. There are thousands of tutorials on line showing you how, with conventional motor controllers. Make sure you choose pins that support PWM.

I know that analogwrite can send pwm on pins that support it. My problem is I legit have no idea how to write code for an arduino.

The goal for forum is not producing code for members wanting new toys. The aim of forum is helping new members to grow in coding.
If You want to learn helpers will assist You. If You only want a new toy, it looks not so good. Most of the documentation needed is missing. System description, schematics, links to datasheets of parts....
Reading the code You tried to supply it's still completely impossible to write any code for You due to all documentation needed.
Try Your friends to make code for You if You don't want to learn it Yourself.

Why is it such a big deal to hook a brother up with some code? It’s not completely impossible, but it may be completely impossible for YOU if that’s the case why bother taking your time to respond

You don't know what You're talking about. How/where will the signal for the second motor enter the stage? Where will the output happen?.....

Making functioning code involves testing it, observing the result. Making "dry code" and post is the worst, most time consuming and difficult way to make things work. Helpers seldomly join such long term projects.

Having that attitude You will not get much help from this forum. Reconsider!
Bye.

Idk man it seems pretty simple. I’m just gonna pay someone on fiverr to do it

You have it very easy, observe the code well, you have some variables, pins, and operations for a channel. Duplicate it all for the other channel by renaming everything to for example _2
Think about it a little, it will be easy for you. upload the result and we correct it.

The Jobs and Paid Collaborations forum section is there to hook a brother up with some code.

I didnt know that thank you.

i originally tried that but i ended up making neither motors work. I didnt save the sketch because it didnt work but this is basically what i wrote.

const int CH_1_PIN=11; //transmitter channel 2 signal to arduino pin11 -receiver ground to arduino ground -power receiver from arduino 3.3v out
const int CH_2_PIN=8; //test
const int deadzone =20; //nuetral stick  
double x,y;
double a,b; //test
int VRsignal = 5; //arduino pin5 to esc 0-5v imput -ground to esc ground -power arduino from esc 5v out
int VRsignal2 = 9;//test
void setup(){
  pinMode(VRsignal, OUTPUT);
  pinMode(VRsignal2, OUTPUT);
  Serial.begin(9600); 
}
void loop(){
  x = pulseIn(11,HIGH);
  y = pulseToPWM(x);
  a = pulseIn (8, HIGH);//test
  b = pulseToPWM(a);//test


analogWrite(VRsignal, y);
  int ch_1 = pulseIn(CH_1_PIN, HIGH,25000);
  Serial.println(pulseToPWM(ch_1));
  delay(5); 
  
analogWrite(VRsignal2, b);//test
  int ch_2 = pulseIn(CH_2_PIN, HIGH,25000);//test
  Serial.println(pulseToPWM(ch_2));//test
  delay(5); //test
  
  }

//convert rc pulse value to motor PWM value
int pulseToPWM(int pulse){
  if (pulse>1000){
    pulse = map(pulse,1000,2000,-500,500);
    pulse= constrain(pulse,-255,255);
    }else{
      pulse=0;
      
}

  if (abs(pulse)<= deadzone){
        pulse=0;
        }
        return pulse; }

If the first code posted actually moves one motor, this one you uploaded is correct for two motors and should move. Check the connections of the two module/arduino/ rc receiver.

In this other link they give you more connection details.