Electrons do indeed generate electric and magnetic fields when they are in motion. These fields can interact with each other and with other charged particles, creating electromagnetic waves. However, the fundamental carriers of the electromagnetic spectrum are photons, not electrons.
Photons are elementary particles that are massless and electrically neutral. They are the quanta or discrete packets of electromagnetic radiation. They are the fundamental particles that make up all forms of electromagnetic waves, including visible light, radio waves, microwaves, X-rays, and gamma rays.
The electromagnetic spectrum encompasses a wide range of wavelengths, frequencies, and energies. Each type of electromagnetic wave corresponds to a specific range within the spectrum, and these waves differ from one another primarily in terms of their wavelength or frequency.
When an electron transitions from a higher energy level to a lower energy level within an atom or a molecule, it emits or absorbs energy in the form of photons. These photons carry the energy and information associated with the electromagnetic wave. The energy of a photon is directly proportional to its frequency (or inversely proportional to its wavelength) according to the equation E = hf, where E is the energy, h is Planck's constant, and f is the frequency of the photon.
While electrons play a crucial role in the generation and interaction of electromagnetic waves, it is the photons that carry and propagate the energy and information associated with the electromagnetic spectrum. Electromagnetic waves can travel through vacuum or various media, and their properties are determined by the characteristics of the photons that constitute them.