Let's say I have one of those conventional through-hole LEDs and I'm applying a sinusoidal voltage to it. From what I understand, at a given time, the same LED is either on or off, and to virtually get different intensities, the duty-cycle of being turned on and off has to change. So, the response is like ones and zeros. Now, let's excite a photodiode with the LED. Will the photodiode's response be ones and zeros too? like, at one moment in time, it's either a set value of current and at another there's no current. Or maybe, the electrons remain excited for a while after the excitation is cut off, and you'd get different amounts of currents depending on the duty-cycle of the LED?
at a given time, the same LED is either on or off, and to virtually get different intensities, the duty-cycle of being turned on and off has to change. So, the response is like ones and zeros.
No, that's incorrect.
The amount of photons emitted from an LED is directly proportional to the current through it.
It's a common method of varying the perceived brightness by using methods like PWM, yes, because it's energy efficient and easy.
Will the photodiode's response be ones and zeros too?
No. The more photons hit it, the higher the current is going to be, so the photodiode itself has a continuous response.
Now, when being illuminated by an off/on pulsed source, it depends on whether that source is pulsed faster or slower than what the bandwidth of the photodiode allows.
Photodiodes are available in bandwidths from Hertzes to hundreds of Gigahertzes, so there's no general answer here - but if it's something with through-hole leads, don't expect more than a couple hundred kilohertz of bandwidth, if at all. Again, you'll really need to read the datasheet of the photodiode, no way around that.
If the bandwidth of the light signal is higher than that of the photodiode, that will have a low-pass effect and lead to a "smooth" signal with arbitrary amplitude.
Let's say I have one of those conventional through-hole LEDs and I'm applying a sinusoidal voltage to it. From what I understand, at a given time, the same LED is either on or off
This is a simplification, but it is not reality; LEDs are diodes and obey the Shockley diode equation like anything else. So if you apply a sinusoid varying voltage, you get a current that varies exponentially but isn't exactly a square wave. The intensity of light output will vary accordingly. There is also a slight lag induced by the self-capacitance of the LED, and a delay (nanoseconds, but not zero) in turn-off time due to bandgap recombining.
Similar phenomena apply to photodiodes; they can be operated in photocurrent or photovoltaic modes, but both give you a continuous range of output depending on how much light is coming in. Plus a tiny "dark current" which depends on ambient temperature and other properties of the photodiode.
(The key to understanding anything to do with electrons is to understand that they're weird probability fields rather than neat little balls; the probability of an electron hopping across a bandgap isn't zero even if there's no light or electric field forcing it to. They can even "tunnel" straight through thin insulators.)