Pages: [1]   Go Down
Author Topic: Serial degrees  (Read 664 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31472
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Full Member
***
Karma: 0
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Miami/Florida
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The map(); function will help you.
Logged

Perseverance is 90% of the solution. The remaining 10% is more perseverance.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31472
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
float degrees = (float)numberOfSteps * 1.8;
Serial.println(degrees);
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Appreciate it.
Logged

Pages: [1]   Go Up
Jump to: