Intro to computers: Analog vs digital.
Computers are basically huge computational devices or calculators. Computational devices can be split into two main categories: Analog and digital.Analog
When I grew up, most devices around me were analog and very few digital. We had records and audio cassettes, televisions with big aerials to receive the signal and dials on their face to adjust the tuning.The way I think of analog systems is that the value is represented as a fraction. Think of this in terms of the volume of a device being 50% or a single dot on the t.v. being at 33% brightness.
In the case of the original t.v.'s, there was a beam projecting charge at the screen, and this beam moved from top to bottom, side to side at a specific speed. The amount of charge sent to that exact spot on the screen was in proportion to the amplitude of the signal. 0% would be black, 100% would be white and there was pretty much an infinite amount of fractions in between.
Electric analog devices were first made about 100 years ago, but other analog devices were in use long before that. We can think of things like sundials, clocks and mercury thermometers as analog devices.
Digital
The invention of the transistor and electric circuits changed things in a very big way.We now have the ability to turn a signal on and off rapidly and detect its state almost instantly.
Rather than a signal being analog, with digital signals we define a voltage below a specific level as off and anything above a specific level as on.
For an arduino, anything below 1/3 VDD is off (Low) and anything above 2/3 VDD is on (High) where VDD is your supply voltage. This is often 5 volts, thus off is 0-1.67 volts and on is 3.33 -5 volts.
This allows for a far more accurate transmission than analog signals. With analog signals, any interference effected the value. With digital signals, the interference needs to be fairly high to convert an off to an on or vice-versa. This hugely increases reliability both in transmission and storage.
To clean a digital transmission, we can place a repeater along its path which receives the original signal and re-broadcasts it at base levels thus removing any interference. This is almost impossible to do with analog signals.
In addition to having a fairly large room for error, digital signals can also include Error Checking and Correcting. This allows us to detect if a digital signal was correctly received and in some cases errors can be corrected.
Analog and Digital together
Many devices are either entirely analog (although this is very rare today) and many are entirely digital e.g. your computer's CPU, keyboard and optical mouse.There are also a large number of devices that can process both digital and analog signals. For example, the sound processing circuitry in your computer can convert an analog signal from your microphone into a digital signal using an ADC (Analog to Digital Converter) and from a digital signal to an analog one for your speakers using a DAC (Digital to Analog Converter).
Many micro controllers, including Arduino, include ADC's and/or DAC's allowing us to interface with the real world which is analog. It is trivial with an Arduino to convert analog readings like temperature or capacitance into data which can be processed digitally.
One complication with the digital world is how exactly we represent the data we are processing and storing. A whole bunch of one's and zero's are meaningless unless we have some sort of standard way of interpreting what they mean and write them out in a way that's understandable to humans.
This will be explained in Number Theory.