Pages: [1]   Go Down
Author Topic: Brushless motor control with Arduino UNO  (Read 658 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

First post and first time Arduino user. I am trying to use 2 brushless motors with ecs for each one with a remote control unit from an old rc car.

I have not seen anyone try this and am not sure what I am doing.
Here are the pins I am using and what they are connected to:

pin A0 - input from R/C receiver
+5v     - power to R/C receiver
GND    - to GND R/C receiver
pin 5   -white to Ecs1
pin 6   -red to ecs1
pin 9   -white to ecs2
pin 10 -red to ecs2

Here is my code:

#include <Stepper.h>

#define STEPS 100

Stepper stepper_left(STEPS, 5, 6);
Stepper stepper_right(STEPS, 10, 11);
int sensorPin = A0;
int sensorValue = 0;
int previous = 0;

void setup()
{
  stepper_left.setSpeed(30);
  stepper_right.setSpeed(30);
 
}

void loop()
{
  sensorValue = analogRead(sensorPin);   
  int val = analogRead(0)
  |analogRead(0)|
  stepper_left.step(val - previous);
  stepper_right.step(val - previous);
  previous = val;
}

I am getting the, void value not ignored as it ought to be at:
  stepper_left.step(val - previous);

I am not sure what the problem is. Any help would be appreciated.
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1073
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A rc ESC expects a signal just like a rc servo, so you should use the servo library.

Connect the black wire from the ESC to ground on your Arduino and the white or yellow wire to the pin on your Arduino that you chose.

Don't connect the red wire to the Arduino, it is 5 Volt that is used to poer a rc receiver
Logged

Hellas
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
when life gives lemons make a lemonade
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, ( Im one of those who have tried that in the past and it worked fine )

Probably you are messing with wrong wiring. Definately the red is wrong. You shoud use common ground between receiver and ESC
Logged

living on an island.....Oh boy, we’re having fun
I wish I'd kept some of my old computers.  

Pages: [1]   Go Up
Jump to: