The English alphabet has 26 symbols in lower case plus the same in upper case, as well as 10 symbols for numbers. Unlike humans, computers communicate with 2 symbols; ’0′ and ’1′. This is called “digital signals”. Using combinations of 0s and 1s, digital machines can represent just about everything in the universe.
When compiling, the code written with human symbols is translated to 0s and 1s; the language that computer understands. When you write a program for Arduino, you represent ’0′ by writing LOW
and ‘1’ by writing HIGH
. Similarly, Arduino represents ’0′ with 0 Volts and ’1′ with 5 Volts.
When talking about digital signals and Arduino, we talk about digital inputs and outputs. Digital input means that the Arduino is receiving digital data from a sensor – for example a button. When reading from button, the Arduino will receive either 5V, HIGH
or 0V, LOW
depending on if the button is being pushed or not. Digital output means that the Arduino is sending digital data to an actuator such as an LED. To turn a LED on, the Arduino sends 5V, HIGH
; to turn it off the Arduino sends 0V, LOW
.
Binary logic
Another common characteristic to all computers is that they use binary logic. Binary logic means that there are only two possibilities. Since a computer uses only two symbols ,’0′ and ’1′, we say that it, too, uses binary logic. In this case, ’0′ represents FALSE
while ’1′ represents TRUE
. Binary logic can also be used to ask questions like, ‘Did the temperature reach 20 degrees?’. The answer is then either true or false and can then be represented with ’1′ or ’0′.