Go Down

Topic: How can I measure the turn-around time of my engine? (Read 156 times)previous topic - next topic

0Avendano

Mar 29, 2019, 09:19 amLast Edit: Mar 29, 2019, 10:22 am by 0Avendano
Thanks for reading my question. I would like to know the time it takes to take a full turn. I have 1 nema 17 engine (stepper motor) but, I want to know how long it takes to complete 1 turn because from that I will make a relationship to be able to put on a keypad and reflect it on an LCD for how long you want it to be turning the motor steps. Try to do a sampling time and using volatile unsigned but it is not very close, so I ask for help. Below leave only the code, where the movement is made, I suppose it will be in the cycle for which the condition will be set. Thank you! sorry if I do not explain myself well, I do not speak English very well.THE COMPLETE CODE IS DOWN, THE DOWNLOADABLE FILE

for (int i = 0; i <a; i ++) {schedule2 ();
for (int i = 0; i <totalpasos2; i ++) {m2 ();} // Equivalent to the number of turns (200 steps are 360º degrees of servo)
// --------- Change of direction of rotation ---------------------------------- -------------------------------------------------- ---
anti-clock2 (); // send direction to the servo
for (int i = 0; i <totalpasos2; i ++) {m22 ();}} // Equivalent to the number of turns (200 steps are 360 degrees of servo)
digitalWrite (reset1, LOW);
break;

case 'F':
for (int i = 0; i <a; i ++) {// Equivalent to the number of turns (200 steps are 360 degrees of servo)
schedule1 ();
schedule2 ();
for (int i = 0; i <totalpasos1; i ++) {// Equivalent to the number of turns (200 steps are 360º degrees of servo)
m1 ();
m2 ();}
// --------- Change of direction of rotation ---------------------------------- -------------------------------------------------- -
anti-clock1 ();
anti-clock2 ();
for (int i = 0; i <totalpasos1; i ++) {// Equivalent to the number of turns (200 steps are 360º degrees of servo)
m11 ();
m22 ();}}
digitalWrite (reset1, LOW);

AWOL

#1
Mar 29, 2019, 10:06 am
Code: [Select]
`anti-clock2 ();`.Do you see a problem there?

Please remember to use code tags when posting code, and don't post snippets.

0Avendano

#2
Mar 29, 2019, 10:11 am
The code is very long, do I publish it to such an extent?

neiklot

#3
Mar 29, 2019, 10:18 am
The code is very long, do I publish it to such an extent?
If it's too long to include in the post (9000 chars I think?), attach the .ino

But an even better way is to cut the code down to the minimum size where it still shows the problem. That way, sometimes you fix the problem in the process.

0Avendano

#4
Mar 29, 2019, 10:23 am
I already uploaded it, thank you very much. I will wait for the answer while I keep thinking

Robin2

#5
Mar 29, 2019, 11:25 am
There can't be any uncertainty about the time for a stepper motor to make one revolution as your program will define the time interval between steps.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up