Interact the LED with photo diode

hi i am new in aurdino
I want to interact the LED with photo diode
I have seen the your code in which LED profile is traingular. and output of photodiode accordingly changes.
In my case. I want LED profile in series of square pulse(step function) and accordingly accordingly output of photodiode should change
My LED profile and photodiode graph like this

Regarding this can i get the aurdino code for this
If possible please reply

Split for an unrelated topic

@sujeetajeet - if you have a new question in future then please start a new topic of your own rather than hijacking an existing one

rearrange your picture.
And your question is?

How to create the square pulse for the LED. ?
When we place the photodiode in front of LED ,so output of photodiode shown in graph.
We want to see the graph for LED and photodiode in serial plotter same as shown in picture?

Take a view here.
Arduino Project 9: Light Sensitive LED.