Lining up Two square pulses on oscilloscope

Hello Im having a bit of trouble lining up two square pulses on my oscilloscope the top one in the purple should drop at the same time as the yellow but there is a delay. I'm pretty new to arduino and I'm still working on my skills.

int speedPin = 10;
    int upIn2 = 9;
    int v = 0;
   
void setup() 
{
  // put your setup code here, to run once:
     
      pinMode(speedPin, OUTPUT);
      digitalWrite(speedPin, LOW);
      pinMode(upIn2, OUTPUT);
      digitalWrite(upIn2, LOW); // Low for now but will need to be used to go in reverse direction
      //pinMode(enablePin, OUTPUT);
      //digitalWrite(enablePin, HIGH);
         
}

void loop() 
  {
    //digitalWrite(upIn2, LOW);
    
     


     while(v<1)  //setting number of overall trials 
     {
        v++;
        
       digitalWrite(upIn2, HIGH);
  
        
      
     
          for(int i = 0; i<=0; i++)       //loop to increment 10 pulses forward
           
            {
              
             

              
              digitalWrite(speedPin, HIGH);     //Pulse width of 3 s
              delay(90);
              digitalWrite(speedPin,LOW);       //off width of 4 s
              delay(40);
              digitalWrite(upIn2, LOW);
              
              //digitalWrite(enablePin,HIGH);    //remains High while running the loop
              
            }

           
            
            
            
            

            

     }

        digitalWrite(upIn2, LOW);
        digitalWrite(speedPin, LOW);
        //digitalWrite(enablePin, LOW);
        
  }

Hi,
Can you post a diagram of what you need with the two output pulses, include your pulse timing.

Your code comments do not match the code.

Thanks... Tom.. :slight_smile:

what type of oscilloscope is it and if analogue what display mode is it in alternate or chop?

TomGeorge:
Hi,
Can you post a diagram of what you need with the two output pulses, include your pulse timing.

Your code comments do not match the code.

Thanks... Tom.. :slight_smile:

Sorry I just posted a pic of the output oscilloscope just now you should be able to see it in the orignal post. I did not know the there was a size spec for posting and the image was to big. But then posts without the pic and then I was not able to post again for 5 min. Let me know if the image is up now and you can see it.

jeon0169:
Hello Im having a bit of trouble lining up two square pulses on my oscilloscope the top one in the purple should drop at the same time as the yellow but there is a delay.

Of course their must be a delay, because it's in your code:

              digitalWrite(speedPin, HIGH);     //Pulse width of 3 s
              delay(90);
              digitalWrite(speedPin,LOW);       //off width of 4 s
              delay(40);  // <------------------- what you write is what you get
              digitalWrite(upIn2, LOW);

Hi,
Do you need both outputs to be always identical?
If so why not just use one output and feed the two sources with it.

What is the application, what do you need the pulses for?

Thanks.. Tom... :slight_smile: