I have changed it according to your tips (btw now I understood it!

. the LED flash is working and the CD is turning. But ... I could not find the right value for the flash frequency (parameter flashlimit)! I have 12 sections on the CD. But picture the sections do not stand still?! I was already counting it up by the programm starting with 1 - but none did work. What value is correct??
-----------------------
byte steps[] ={0B00000010,0B00000010,0B00001000,0B00001000,0B00000100,0B000000100};
byte outModes[] ={0B00011010,0B00010110,0B00011100,0B00011010,0B00010110,0B00011100};
unsigned int stepDelay = 50; // microseconds, multiplied by the value read from the pot on A0
byte potPin = 0;
byte bemfPin = 1;
byte bemfCompPin = 1;
long potPinValue;
int bEMF;
int bEMFTimeSet;
unsigned int actualStepDelay;
unsigned long periodNow; // microseconds since last step
unsigned long serialPeriodNow;
unsigned long rpm;
int serialDelay = 5000;
int i=0; // counter for the steps
int currentFlash;
int flashlimit=3;
void setup() {
Serial.begin(9600);
pinMode(potPin, INPUT);
pinMode(bemfPin, INPUT);
pinMode(bemfCompPin, INPUT);
}
void loop() {
potPinValue = analogRead(potPin);
actualStepDelay = potPinValue * stepDelay;
if ((micros() - periodNow) > actualStepDelay) {
// time to switch windings to another state
DDRB = outModes
; // input or output? If input, it becomes high-Z, we can use those to measure back-EMF
currentFlash = currentFlash + 1;
if(currentFlash>flashlimit)
{currentFlash=0;
PORTB = steps | 0B00010010; //with flash
}
else
{PORTB = steps;} // commutation
periodNow=micros();
if(i==2) { /*winding C is open, can read backEMF from it for speed calculations, compare to winding B which is zero in this step*/
bEMF = analogRead(bemfPin);
}
i++;
if(i>5) { i=0;}
}
if((millis() - serialPeriodNow) > serialDelay)
{
//flashlimit=flashlimit+1;
rpm = 1666666.7/actualStepDelay; //actualStepDelay*36 = duration of 1 rotation in microseconds. 60,000,000/36 = 1666666.666667
Serial.print("Actual Step delay: ");
Serial.print(actualStepDelay);
Serial.print(" | RPM: ");
Serial.println(rpm);
Serial.print("Last BackEMF comarative read: ");
Serial.println(bEMF);
Serial.println(flashlimit);
serialPeriodNow=millis();
}
}