How to give a proper trigger signal (mp3card,

Hello Arduino users!

Been trying for myself now for 15 hours how to fix this problem.

The problem is that i need to send a LOW to the SoundPin for only 50 milliseconds for it to give out the correct sound. the code i have down here is, making " tikk,Tikk,Tikk,Tikk" sound in the speaker all time while the preroll " if" is going on. This is making the other sounds that maybe can land in here N/A This is a shortened down code of the project.

How can i make this code send a LOW to the mp3 card for only 50 milliseconds then stay high the rest?

Been trying to deal with OffTime and OnTime, and it works, but not just on this motor code.

Sorry for my english. And thanks for help. So much appreciated!

Sondre.

// pins
const int soundPin = 5;  // Pin that sends signal to the other arduino with the mp3shield.
const int motorPin = 6;     // Motor Pin.

// motor
bool motorState = true;   // 


// timing constants
const unsigned int Ontime = 3000;      // on time for motor should be 3 seconds
const unsigned long Offtime = 40000;   // of time of the motor 40 Seconds.
const unsigned long preroll = 8000; // preroll time ( 8 seconds)  (before motor turns on) 

// timing variables
unsigned long currentTime;
unsigned long Lasttime = 0;
unsigned long motorInterval = 0;

void setup()
{
  pinMode(motorPin, OUTPUT);
  pinMode(soundPin, OUTPUT);
  digitalWrite(soundPin, HIGH);
}

void loop()
{
  // get current time
  currentTime = millis();

  // if motor is off
  if (motorState == false)
  {
    if (currentTime - Lasttime >= (Offtime - preroll))
    {

      digitalWrite(soundPin, LOW);
    }

    if (currentTime - Lasttime >= Offtime)
    {
      Lasttime = currentTime;
      motorState = !motorState;
      digitalWrite(motorPin, motorState);
    }
  }
  // if motor is on
  else
  {
    if (currentTime - Lasttime >= Ontime)
    {
      Lasttime = currentTime;
      motorState = !motorState;
      digitalWrite(motorPin, motorState);
      digitalWrite(soundPin, HIGH);
      
    }
  }
}