fatal error: delay.h: No such file or directory

The program that runs on the Arduino mini nice work.
On the duo writes me: Fatal Error: delay.h: No such file or directory
Does anyone know what is the replacement for

include <delay.h>

volatile long motor_position, encoder;

Please reply.

The "Arduino Due" ?
Not all libraries for the normal Arduino boards work on the Arduino Due.
Which library are you using ?

The "delay.h" is needed for "_delay_us".
If you use the Arduino function "delayMicroseconds" you can remove the "delay.h".

Do not include that.

Remove this: #include <delay.h>
Keep this: volatile long motor_position, encoder;

Hi Peter,
yes i to change is the numbers in those attachInterrupt lines.I had also to change in/out pin.
However, I have the same problem as before. At a higher speed encoder stepper motor slow work.
If encoder slowly move work ok. There is no error in the Arduino mini but in the program.
Can you help me how can I fix the error that signals from encoder fast read and sent to the stepper motor.
This is new code

#define encoder_a 22 //keep this on and interrupt pin
#define encoder_b 23 //keep this on and interrupt pin
#define motor_step 53 //can be any pin
#define motor_direction 52 //can be any pin

volatile long motor_position, encoder;

void setup () {
  //set up the various outputs
  pinMode(motor_step, OUTPUT);
  pinMode(motor_direction, OUTPUT);
  // then the encoder inputs
  pinMode(encoder_a, INPUT);
  pinMode(encoder_b, INPUT);
  // enable pullup as we are using an open collector encoder
  digitalWrite(encoder_a, HIGH); 
  digitalWrite(encoder_b, HIGH); 
  // encoder pin on interrupt 0 (pin 2)
  attachInterrupt(22, encoderPinChangeA, CHANGE);
  // encoder pin on interrupt 1 (pin 3)
  attachInterrupt(23, encoderPinChangeB, CHANGE);
  encoder = 0; //reseet the encoder position to 0

void loop() {
  //do stuff dependent on encoder position here
  //such as move a stepper motor to match encoder position
  //if you want to make it 1:1 ensure the encoder res matches the motor res by dividing/multiplying
  if (encoder > 0) {
    digitalWrite(motor_direction, HIGH);// move stepper in reverse
    digitalWrite(motor_step, HIGH);
    digitalWrite(motor_step, LOW);
    delayMicroseconds(600); //_delay_us(200); //modify to alter speed
    encoder = 0; //encoder--;
  else if (encoder < 0) {
    digitalWrite (motor_direction, LOW); //move stepper forward
    digitalWrite (motor_step, HIGH);
    digitalWrite (motor_step, LOW);
    delayMicroseconds(600); //_delay_us(200); //modify to alter speed
    encoder = 0; //encoder++;

void encoderPinChangeA() {
  if (digitalRead(encoder_a)==digitalRead(encoder_b)) {

void encoderPinChangeB() {
  if (digitalRead(encoder_a) != digitalRead(encoder_b)) {
  else {