I want to make a sequential PWM through Arduino UNO

fig

I want to make a sequential PWM through Arduino UNO.

Please refer to the image.

  1. I want to turn on/off the LED through the control of 4 digital pins.
  2. ON-TIME time of 4 digital pins is 100us.
  3. It should turn on and off sequentially.
  4. It can be created through 'digitalWrite()', but the exact value does not come out.
  5. By any chance, there is no other way.
  • The digital output can be any pin on the Arduino Uno.
#define pwm_p1  2
#define pwm_p2  3
#define pwm_p3  4
#define pwm_p4  5
long TIMER_EVENT = 0;


void setup(){
 Serial.begin(115200);
 pinMode(pwm_p1,OUTPUT); pinMode(pwm_p2,OUTPUT);
 pinMode(pwm_p3,OUTPUT); pinMode(pwm_p4,OUTPUT); 
}


void loop(){

if(TIMER_EVENT < millis()){
   TIMER_EVENT = millis() + 1;
  digitalWrite(pwm_p1, HIGH); 
  delayMicroseconds(100);      
  digitalWrite(pwm_p1, LOW);  
  delayMicroseconds(100);  
  digitalWrite(pwm_p2, HIGH); 
  delayMicroseconds(100);      
  digitalWrite(pwm_p2, LOW);  
  delayMicroseconds(100);  
  digitalWrite(pwm_p3, HIGH); 
  delayMicroseconds(100);      
  digitalWrite(pwm_p3, LOW);  
  delayMicroseconds(100);     
  digitalWrite(pwm_p4, HIGH); 
  delayMicroseconds(100);      
  digitalWrite(pwm_p4, LOW);  
  delayMicroseconds(100);  
}
  
}

Where’s the PWM involved ?

I think you can address this quite easily once the actual problem is identified.

@lastchancename

  1. Practically nothing to do with 'PWM'.
  2. Only 'HIGH' and 'LOW' signals are output sequentially.

It is expressed as PWM because the signal comes out with a cycle.

Here's an example simulation ... for 100μs, just change the timer initialize value to 100.

@dlloyd

understand.
thank you.