Hello everyone, I'm from Argentina, excuse my english
I'm doing a "slow car that carries some weight" which has two wheels to turn and traction back (and two free wheels forward) --- are two stepper motors nema17 high torque.
I try to handle it with my radio control station (PWM) and arduino.
ohhh I forgot, there are also two DRV8825 controllers to move the motors.
I just tried the Arduino-DRV8825 set and engines with a code and they work perfect. I also adjusted the current in the drivers.
I am finding it difficult to find a code that I can use with my radio and my engines to drive this micro car.
Is there any code already made for this? I understand that I would have to connect my pins according to the program ...... but programming I do not know anything! I will appreciate a lot of help ... it is sad to see the engines turned off
Standard servo signals are traditionally read using pulseIn() to measure the pulse width, although interrupts can also be used if you
want it to be done in the background.
I'm presuming by "radio control station (PWM)" you mean standard RC receiver?
with this code I can move an engine alone ... but it pauses and then continues ...
It's too simple for my project but it works
Does anyone know how to improve this for two engines?
PIN 2 = INPUT from RC Receiver
PIN 9 = DIR
PIN 10 = PUL
#include <Stepper.h>
int ch2 = 0;
const int stepsPerRevolution = 200;
// initialize the stepper library:
Stepper myStepper(stepsPerRevolution, 9, 10);
I do not care for using pulsein() to read an RC receiver.
It blocks other processing.
I prefer to use interrupts. As MarkT pointed you to up in reply #4.
Without any of the motor control, try using the sample code to read RC values and print them to the serial monitor.
Then when you get that working, try using the RC values to decide what to do with your motors.
If you have difficulty with anything along the way, post the code here (don't forget to use code tags).
Then explain your difficulty. Best to do so like this:
I expected the code to do 'this'
It actually did 'that'
And unless it is very evident, explain how 'this' and 'that' differ.
You might notice that this method of describing your difficulty differs from your statement in reply #6.