cancel
Showing results for 
Search instead for 
Did you mean: 

would anyone happen to have c code to run a nema 17 stepper motor

semed abubakar
Associate II

I am a hobbyist and I am doing a project on stepper motor its my first time with a stepper motor so far I cant get it runnning

I written functions to set and clear the GPIO pins so far i get vibration for the motor but not the clock wise rotation i intend to the code is below any comments

GPIO_Pin_Clr(9, 'b');         //rotate clockwiss 1

GPIO_Pin_Set(8,'b');

 GPIO_Pin_Set(7, 'B');

   GPIO_Pin_Set(6,'b');

Delay(2);

GPIO_Pin_Set(9, 'b');         //rotate clockwiss 2

GPIO_Pin_Clr(8,'b');

 GPIO_Pin_Set(7, 'B');

   GPIO_Pin_Set(6,'b');

Delay(2);

GPIO_Pin_Set(9, 'b');         //rotate clockwiss 3

GPIO_Pin_Clr(8,'b');

 GPIO_Pin_Set(7, 'B');

   GPIO_Pin_Set(6,'b');

Delay(2);

GPIO_Pin_Set(9, 'b');         //rotate clockwiss 4

GPIO_Pin_Set(8,'b');

 GPIO_Pin_Clr(7, 'B');

   GPIO_Pin_Set(6,'b');

Delay(2);

GPIO_Pin_Set(9, 'b');         //rotate clockwiss 5

GPIO_Pin_Set(8,'b');

 GPIO_Pin_Clr(7, 'B');

   GPIO_Pin_Set(6,'b');

Delay(2);

GPIO_Pin_Set(9, 'b');         //rotate clockwiss 6

GPIO_Pin_Set(8,'b');

 GPIO_Pin_Clr(7, 'B');

   GPIO_Pin_Clr(6,'b');

Delay(2);

GPIO_Pin_Set(9, 'b');         //rotate clockwiss 7

GPIO_Pin_Set(8,'b');

 GPIO_Pin_Set(7, 'B');

   GPIO_Pin_Clr(6,'b');

Delay(2);

GPIO_Pin_Clr(9, 'b');         //rotate clockwiss 8

GPIO_Pin_Set(8,'b');

 GPIO_Pin_Set(7, 'B');

   GPIO_Pin_Clr(6,'b');

Delay(2);

0 REPLIES 0