Go Down

Topic: tryiing to get a stepper motor to work on ardiuno (Read 2 times) previous topic - next topic

Joes

hi
i have a bipolar stepper motor what i need to controlon my ardiuno im trying to control it with a 10k temperaturometer so basically the stepper motor reanacts what the pot is doing but i need to be able to set a amount of degrees the motor will rotate eg 180 degrees
i have no idea how to program this so any help would be appreciated

thanks Joe

PaulS

What don't you know how to do?

How to read the temperature sensor? How to convert the temperature sensor value to a stepper position? How to make the stepper motor step the required number of steps? All of the above?

Joes

sorry my bad spelling i meant potentiomenter theres no temperature sensor
basically how to do the programming for all of it i find it hard to get the programming round my head lol

thanks Joe

PaulS

Code: [Select]
#define potPin 1 // Change to whatever pin the
// potentiometer is connected to

void setup()
{
}

void loop()
{
   int potVal = analogRead(potPin);
   int stpPos = map(potVal, 0, 1023, 0 180);
}


This code will read the potentiometer setting, and map that value from a range of 0 to 1023 to a range of 0 to 180.

Without knowing anything about your stepper motor, and how it is connected, I can't help you with any more code.

The range that you are talking about (0 to 180) makes me think that you are talking about a servo, rather than a stepper motor.

Tell us more about the actual hardware, and we can move on.

Joes

her is a picture of my setup
digital pins 8,9,10, 11 are connected to the motor
and analog pin 0 is connected to the centre of the potentiomenter


hope this is some help

thanks Joe

Go Up