Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am new to the embedded field and using stepper motor for first time. I am using Nucleo F767ZI board for my project and facing issues with interfacing it stepper and servos motors. I am using the ARM mbed compiler.
Can anyone please share the simple code for stepper and servo motor.

What I have tried:

I tried using the codes given in the cook on ARM mbed website.
Posted
Comments
Mohibur Rashid 27-Sep-17 2:27am    
Not a right forum for this question
Most People here do not like when the question is "Can you provide Code".
This site encourage people who try themselves.

You better share your source code and circuit diagram
CPallini 27-Sep-17 2:45am    
"I tried using the codes given in the cook on ARM mbed website."
What problems did you experience?
RishG 27-Sep-17 7:07am    
I am using the following code for the servo motor while interfacing it NUCLEO F767ZI using PWM.
The problem I am facing is that the motor is running continuously ,please tell me the error in code. I want to run the motor in steps i.e. 0, 90,180,360 degree steps.


#include "mbed.h"
// Using code to control servo motor using PWM

PwmOut PWM1(PC_8);

int main()

{


PWM1.period(0.020); //PWM period to 20ms

{
PWM1.pulsewidth_ms(1.25); //PWM duty cycle for 0 degree rotation
wait(10);
PWM1.pulsewidth_ms(1.5); //PWM duty cycle for 90 degree rotation
wait(10);
PWM1.pulsewidth_ms(1.75); //PWM duty cycle for 180 degree rotation
wait(10);
PWM1.pulsewidth_ms(2); //PWM duty cycle for 360 degree rotation
wait(10);

}
}

1 solution

We can't give you specific code: the hardware interface between your board and the stepper motor is completely unknown to us. You need to start by looking at how it is physically connected to the processor, and how that connection is handled by software. Then look at the stepper, and see what you have to do to that connection to make it "step" in one direction or the other. That should tell you what to start looking for - but at the moment all you are asking is "How do I get to work?" without us knowing where you live, where your work is, if you can drive, if you can afford a train, how long you have to get there, or even if you have a job!

Start by getting information together - it's possible the hardware person who interfaced it can help you here - and then start looking for info on that. I'd also recommend that you start with the STMicroelectronics[^] website and see what support you can find or get there (they may have been a PITA as a company, but their support wasn't bad when I used it many years ago) since I think they make the evaluation board you are trying.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900