Full step to half step stepper

I have a stepper and a Wemos D1. However, there is something wrong with the Wemos as I can not use libaries with the stepper. I found a code that work. However, it is for full step but I want to use half step, and my programming skills are not sufficient to understand the code. Is there some one how understands what needs to be changed to transfere the code to half step?

// ESP-12F(WeMos D1 mini)
#define IN1 14 //GPIO 14
#define IN2 12 //GPIO 12
#define IN3 13 //GPIO 13
#define IN4 15 //GPIO 15

const int NBSTEPS = 4095;
const int STEPTIME = 900;
int Step = 0;
boolean Clockwise = true;

int arrayDefault[4] = {LOW, LOW, LOW, LOW};

int stepsMatrix[8][4] = {
{LOW, LOW, LOW, HIGH},
{LOW, LOW, HIGH, HIGH},
{LOW, LOW, HIGH, LOW},
{LOW, HIGH, HIGH, LOW},
{LOW, HIGH, LOW, LOW},
{HIGH, HIGH, LOW, LOW},
{HIGH, LOW, LOW, LOW},
{HIGH, LOW, LOW, HIGH},
};

unsigned long lastTime = 0L;
unsigned long time = 0L;

void writeStep(int outArray[4]);
void stepper();
void setDirection();

void setup() {
//Arduino UNO
//Serial.begin(9600);

//ESP8266
Serial.begin(115200);
Serial.println("Starting...");
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}

void loop() {
unsigned long currentMicros;
int stepsLeft = NBSTEPS;
time = 0;
lastTime = micros();
while (stepsLeft > 0) {
currentMicros = micros();
if (currentMicros - lastTime >= STEPTIME) {
stepper();
time += micros() - lastTime;
lastTime = micros();
stepsLeft--;
}
delay(1);
}
Serial.println(time);
Serial.println("Wait...!");
delay(400);
//Clockwise = !Clockwise;
stepsLeft = NBSTEPS;
}

void writeStep(int outArray[4]) {
digitalWrite(IN1, outArray[0]);
digitalWrite(IN2, outArray[1]);
digitalWrite(IN3, outArray[2]);
digitalWrite(IN4, outArray[3]);
}

void stepper() {
if ((Step >= 0) && (Step < 8)) {
writeStep(stepsMatrix[Step]);
} else {
writeStep(arrayDefault);
}
setDirection();
}

void setDirection() {
(Clockwise == true) ? (Step++) : (Step--);

if (Step > 7) {
Step = 0;
} else if (Step < 0) {
Step = 7;
}
}

That code is half step. It performs 8 steps, while a basic full step action has only 4 steps. My guess is that your motor simply doesn't react to the half step, but stays on the previous full step position.

I have a stepper

Unipolar or bipolar? Volts and current? Driver?
HowToPostCode

You need to provide all the details mentioned in Reply #2

Also tell us what library would not work.

...R

Stepper Motor Basics
Simple Stepper Code

I use a 12V 28BYJ-48 with a ULN2003. I thought half step had two high at once, not only one - which I guess the code above has?

Today I manage to get the stepper.h lib to work, but it totally mess up the serial output. The code below, which should be half step does work, but it also totally mess up the serial. The serial works perfectly with the code above. The serial allways works if I use my Uno - very confusing! Therefore i would like to have it modified the code above to half step to maximize the torq - and be able to have a working serial output.

int currentStep = 0;
bool clockwise = true;
int targetSteps = 2048; //2049 steps per rotation when wave or full stepping
int DelayTurn = 5500; //Set the speed of the motor; Delay in micro seconds (not milli) 2000=highest speed
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);

for(int pin = 0; pin < 4; pin++) {
pinMode(pins[pin], OUTPUT);
digitalWrite(pins[pin], LOW);
}
}

void step(int steps[][4], int stepCount) {
//Then we can figure out what our current step within the sequence from the overall current step
//and the number of steps in the sequence
int currentStepInSequence = currentStep % stepCount;

//Figure out which step to use. If clock wise, it is the same is the current step
//if not clockwise, we fire them in the reverse order...
int directionStep = clockwise ? currentStepInSequence : (stepCount-1) - currentStepInSequence;

//Set the four pins to their proper state for the current step in the sequence,
//and for the current direction
for(int pin=0; pin < 4; pin++){
digitalWrite(pins[pin],steps[directionStep][pin]);
}
}

void loop() {

int stepCount = fullStepCount;
step(fullSteps,fullStepCount);

// Increment the program field tracking the current step we are on
++currentStep;

// If targetSteps has been specified, and we have reached
// that number of steps, reset the currentStep, and reverse directions
if(targetSteps != 0 && currentStep == targetSteps){
currentStep = 0;
clockwise = !clockwise;
} else if(targetSteps == 0 && currentStep == stepCount) {
// don't reverse direction, just reset the currentStep to 0
// resetting this will prevent currentStep from
// eventually overflowing the int variable it is stored in.
currentStep = 0;
}

delayMicroseconds(DelayTurn);

}

Much late and maybe you do not need it anymore, but you can use my software http://rapidcnc.it
Site is in italian language, I hope it's not a problem.