Hello there! I’m new to the ardunio, I have to create a way to drive a stepper motor with a potentiometer, ie for each angle of the potentiometer is moved an angle equal to the stepper motor which will have a second pot to Feedback. Using a dedicated driver Polulu that I generate pulses on a pin and another pin I generate a pulse direction, which goes to a HIGH and LOW direction goes to another.
As follows in the drawing down there.
Thank you if you can help me.
Ai down a code that did this to test the analog inputs and some variables, then not progressed more.
Thanks
int PotMan = A0;
int PotMot = A1;
int StepPin = 2;
int DirPin = 3;
int ValorManete = 0;
int ValorMotor = 0;
int v1=0;
Click on that # button when you edit your post, and it will put [ code ] and [ /code ] tags in. Put your code in between those, and it will prevent the forum software from munging your code.
It’s because I was concentrating on other things, but thanks for the detail.
After burning many neurons could make the PID software and it worked perfectly. Oh that some photos of the project working. Now I have to create routines to improve the scales and adjustments to the degrees needed. If you have suggestions for improving the program. Thank you very much. down there in this program.
//============================================================================================================
// PROGRAMA DO LEO =
//============================================================================================================
//
//============================================================================================================
// VARIAVEIS =
//============================================================================================================
int Pot = A0;
int PotM = A1;
int Stepp = 2;
int Dir = 3;
int ValorMan = 0;
int ValorMot = 0;
int val3=10;
int last = 0;
int current = 0;
int difference = 0;
//int y = 0;
//int b = 0;
int c =0;