create different pulses

Hello all,
I wrote the folowing code to create some pulses but I have one problem where I need some help. Every time I make a choice for a pulse, the pulse starts from "OFF" state. How can I wrote the code so pulse starts with "ON" state?

Thanks in advance.
Panagiotis

 int highSince = 0;  
 int lowSince = 0;  
 int ledStatus = LOW; 
 int counter=0;
 int now=0;
char ch=0;//gia energopoihsh
void setup() {
  // put your setup code here, to run once:
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
Serial.begin(9600);
}

void loop() {


  if(Serial.available()>0){
  ch=Serial.read();
 
  }//end if
   now=millis();
  if (ch=='a'){//aeroporiki prosbolh
   
    if(ledStatus == LOW && now - lowSince >= 1000)  
      {  
           highSince = now;  
           ledStatus = HIGH;  
           digitalWrite(13, HIGH);  
           digitalWrite(12, HIGH);
      }  
      else if(ledStatus == HIGH && now - highSince >= 3000)  
      {  
           lowSince = now;  
           ledStatus = LOW;  
           digitalWrite(13, LOW); 
           digitalWrite(12, LOW); 
      } 
       
 
 
  }
  if (ch=='b'){//epigeia prosbolh
    
    if(ledStatus == HIGH && now - highSince >= 30000)  
      {  
           lowSince = now;  
           ledStatus = LOW;  
           digitalWrite(13, LOW); 
           digitalWrite(12, LOW); 
      } 
    
      
      else if(ledStatus == LOW && now - lowSince >= 30000)  
      {  
           highSince = now;  
           ledStatus = HIGH;  
           digitalWrite(13, HIGH);  
           digitalWrite(12, HIGH);
      }
     
        
  }
  if (ch=='c'){//PBX prosbolh
 
   if(ledStatus == HIGH && now - highSince >= 1000)  
      {  
           lowSince = now;  
           ledStatus = LOW;  
           digitalWrite(13, LOW); 
           digitalWrite(12, LOW); 
      }
   
       
      else if (ledStatus == LOW && now - lowSince >= 1000)  
      {  
           highSince = now;  
           ledStatus = HIGH;  
           digitalWrite(13, HIGH);  
           digitalWrite(12, HIGH);
      }
      
   
  }
    if (ch=='d'){//Polemiki kinitopoihsh   
    if(ledStatus == LOW && now - lowSince >= 0)  
      {  
           highSince = now;  
           ledStatus = HIGH;  
           digitalWrite(13, HIGH);  
           digitalWrite(12, HIGH);
      }  
      else if(ledStatus == HIGH && now - highSince >= 180000)  
      {  
           lowSince = now;  
           ledStatus = LOW;  
           digitalWrite(13, LOW); 
           digitalWrite(12, LOW); 
      } 
      
    }
 
   if (ch=='r'){//reset all
 
  digitalWrite(13,LOW);
  digitalWrite(12,LOW);
   Serial.print("r\n");
}
if (ch=='e'){
  if(ledStatus == LOW && now - lowSince >= 0)  
      {  
           highSince = now;  
           ledStatus = HIGH;  
           digitalWrite(13, HIGH);  
           digitalWrite(12, HIGH);
      }  
      else if(ledStatus == HIGH && now - highSince >= 60000)  
      {  
           lowSince = now;  
           ledStatus = LOW;  
           digitalWrite(13, LOW); 
           digitalWrite(12, LOW); 
      } 
      
     Serial.print("e\n");
} 

}//end of loop

Do you understand what the definition of a pulse is?

Yes I had understood, what did you mean?
I want when arduino receives a character from serial port to create a specific pulse, but because I connect a relay and a siren to digital pins(except from led) I want when arduino receives the character the pulse starts from HIGH. I know that in essence is the same pulse.

panagiotispir:
I want when arduino receives the character the pulse starts from HIGH.

digitalWrite(pulsePin, HIGH);

...R

Thank you guys! Finally I wrote

int flag=0;
if(counter==0){
digitalWrite(pulsePin, HIGH);
flag=flag+1;
}

this if executes only the first time, so I succeeded to start with PulsePin HIGH

Thanks again

panagiotispir:
this if executes only the first time, so I succeeded to start with PulsePin HIGH

Because you have only posted a snippet I have no idea where your code is within your complete program.

I had assumed you would put digitalWrite(pulsePin, HIGH); in setup() where it would only be executed once when the Arduino was reset.

...R

I guess you meant if(flag==0){

Also guessing that PulsePin is still going low in setup (for 4µs-xxxµs), but now it's immediately written high in the first pass of the main loop (with your updated code snippet).

Guessing it's still "impulsing" low because you have something like this in setup:

pinMode(pulsePin, OUTPUT);       // pulsePin defaults LOW

or this:

pinMode(pulsePin, OUTPUT);       //  pulsePin defaults LOW
digitalWrite(pulsePin, HIGH);    //  pulsePin changes to HIGH

The quick impulse LOW can be prevented with this:

pinMode(pulsePin, INPUT_PULLUP); // pulsePin changes from floating to pulled HIGH (30-50K) 
pinMode(pulsePin, OUTPUT);       // pulsePin defaults HIGH

or this:

digitalWrite(pulsePin, HIGH);    // pulsePin changes from floating pulled HIGH (30-50K)
pinMode(pulsePin, OUTPUT);       // pulsePin defaults HIGH