Binary code, on which everything most computers are based (the exceptions is experimental quantum computing) on 2 signals. Traditionally, this is represented by 1 and 0, but this can also be positive and negative, up and down, left or right.
In computing, this is the variance in voltage. Voltage moves in a sine wave, up and down. Various electrical components can affect the speed (frequency, measured in hertz) and power (current, measured in amps), adjusting the value of the sine wave. Above a certain voltage, a system will receive a 1. At a lower voltage, that will return a 0.
Devices such as light sensors, temperature sensors, etc operate by exerting more energy when exposed to a source. Older systems used metal expanding and contracting, but there are smaller, more electrical methods now.
Transistors work by using logic gates, essentially working as switches.
If a transistor has two switches, and AND gate will be active and return a 1 when both are active, otherwise it will return a 0. On an OR gate, it will return a 1 when both or either is active. There are additional logic elements available for other combinations, such as NOR, NAND, XOR, XAND, etc, which are more applicable when there are more switches.
The more transistors that are available in a circuit, the more complex and more quickly combinations of 1s and 0s can be output (usually to storage or memory).
One 1 or 0 is a “bit”.
A byte is 8 1s or 0s – such a 01101101, which a processor can read as a a character. This is binary code.
If an input frequency is 60 cycles per second, with enough transistors, you can adjust the signal to result in, say, putting a “3” on a digital LED. Then a “:”, a “4”, and finally a “5”, creating a digital clock.
A kilobyte is 1000 bytes, and a megabyte is 1000 kilobytes, stepping put. Systems today can operate in petabytes, which is 1000 terabytes. When there is that much data, processors need to be faster and faster, resulting in being able to use more data. It’s a transistor race.
Each processors does things differently. Different arrays of transistors in different patters specializing in different things. There is one uniting factor – the transistor processing an electrical current into an output.