Binary is a way of representing data using only two digits: 0 and 1. These digits are known as bits and they can be combined to create all sorts of data. All of our data needs to be in binary if we want to store it on our computers.
What is binary?
Integrated circuits or microcontrollers contain billions of transistors that act like switches. At any point in time, a switch can be in one of two states: either the current is flowing or not! From programming on Arduino, we have seen that when current was flowing through a digital component it gave us a HIGH reading and a LOW reading when it was not. Binary is the language of computers, and for the sake of understanding each other, anything that has exactly two possible states can be thought of as binary.
Example | Values |
Voltage in a component. | HIGH or LOW |
The state of a switch. | On or Off |
Numerical symbols. | 1 or 0 |
Answer to a polar question, e.g., "Can you see it rain outside?" | Yes or No |
Boolean expressions, e.g., A AND B. | True or False |
What data do we want to represent in our computer?
Data can be anything: from instructions for the computer to carry out, to text, music, photos, and more! Anything that has meaning to us e.g., a picture of our pet, needs to be stored into the computer as binary.
The more complex our data the looks like in the real world then the more binary is needed to represent it and store it in our computer.
How do we go about representing something in binary?
This process is called digitization and there are various ways to do this depending on our needs. The following are the ones you need to be aware of.
Binarization
Converting something into binary form. For example, let's say we have a simple robot arm like the one on the right with three components: Base, Arm, and Gripper. Each component can be in one of two states, either it is functioning (1) or it is not (0).
Base | Arm | Gripper |
0 | 1 | 1 |
Numerical Digitization
In Chapter 17 we will look into converting numbers e.g., 75 to binary. In Chapter 20 we will look into alphanumeric encoding systems like ASCII where each letter gets assigned a number. We also use this technique to represent analog signals from sound or images which is covered in more detail in Chapter 45.
Comments