Go Down

Topic: Serial degrees (Read 909 times) previous topic - next topic

Bstanko6

I think I'm in the right forum.
I have a stepper motor that I hooked up to a pot, I now want to set up the serial to read in 360 degrees. I looked in the libraries, and I did not find anything, I tried google, but I don't think I'm searching the right parameters, as I get nothing of use. Any one know keywords for a search, or can point me in the right direction?

Grumpy_Mike

Sorry I don't understand what you mean by:-
Quote
to set up the serial to read in 360 degrees.

Bstanko6

I would like to read the motor as it turns to read 360 degrees. I want to know what the position is on the motor for reference.

arduinoadrian

The map(); function will help you.
Perseverance is 90% of the solution. The remaining 10% is more perseverance.

Grumpy_Mike

So I think you want to output a number in degrees to the serial port.
This depends on how many steps your motor takes to complete one revolution. If it is a 200 step motor this means that each step is 1.8 degrees.
So simply multiply the number of steps the motor has taken by 1.8. Note that this will mean converting the variables into the float type.
Code: [Select]

float degrees = (float)numberOfSteps * 1.8;
Serial.println(degrees);

Bstanko6


Go Up