Step motor movement

I have found code for running a step motor ( https://os.mbed.com/users/XtaticO/code/sMotor/file/4b3b9e047ce3/sMotor.cpp/ ), however I am not sure if it is correct:

void sMotor:anticlockwise() { //rotate the motor 1 step anticlockwise
for(int i = 0; i < 8; i++) {
switch (i) { // activate the ports A0, A2, A3, A3 in a binary sequence for steps
case 0: {
_A0=0;
_A1=0;
_A2=0;
_A3=1;
}
break;
case 1: {
_A0=0;
_A1=0;
_A2=1;
_A3=1;
}
break;
case 2: {
_A0=0;
_A1=0;
_A2=1;
_A3=0;
}
break;
case 3: {
_A0=0;
_A1=1;
_A2=1;
_A3=0;
}
break;
case 4: {
_A0=0;
_A1=1;
_A2=0;
_A3=0;
}
break;
case 5: {
_A0=1;
_A1=1;
_A2=0;
_A3=0;
}
break;
case 6: {
_A0=1;
_A1=0;
_A2=0;
_A3=0;
}
break;
case 7: {
_A0=1;
_A1=0;
_A2=0;
_A3=1;
}
break;
}

wait_us(motorSpeed); // wait time defines the speed
}
}


The rest of the class works with this implementation, am I right in assuming that calling this function will move the motor 8 steps, and not one, or is there something I do not understand.

• It appears to move 8 half-steps. – Chu Jun 19 '18 at 22:18
• Top understand what's going on you need a drawing of the motor wires and how the bits drive those wires (probably via an H- bridge), and what those wires go to inside the motor (i.e four electro-magnet coils). The bit sequence energizes those coils in an order that generates a rotation. – vicatcu Jun 19 '18 at 23:38
• not sure if it is correct .... correct for what? .... it would totally not work on my arduino – jsotola Jun 20 '18 at 0:23