Binary from Scratch
Hello! Welcome
We are going to learn about the fascinating world of binary system, from Scratch!
What is the binary system?
The binary system is a number system that uses only two digits: 0 and 1.
It is very important because computers use binary to process information and perform calculations.
How does binary work?
Normally we use a decimal system, which uses digits from 0 to 9.
Instead, in binary, each number is represented with a series of 0s and 1s.
How does binary work?
Otherwise, it’s not that different from what you think. U
You’re doing great!
With binary, we can represent many things
Representation of positive integers
Positive integers in binary are directly represented by a sequence of 0s and 1s.
For example, 7
in decimal is 0111
in binary
Representation of negative integers
Negative integers are represented using two’s complement.
It takes a bit to get the hang of it, but it simplifies operations a lot!
Floating-point numbers in binary
Floating-point numbers are represented with a significand (mantissa) and an exponent.
Character representation
We can also represent characters in binary. For example, using codes like ASCII.
For instance, the letter ‘A’ is represented as 01000001 in binary.
You’re almost there!
We just need to see how to program your Arduino
Arithmetic operations
With binary numbers, we can perform arithmetic operations like addition, subtraction, multiplication, and division.
These operations are not very different from those in the decimal system (adapted to binary format).
Binary operations
But there are also binary operations, such as AND, OR, and XOR.
These are performed bit by bit, comparing each pair of bits in two binary numbers.
Conversions
Of course, we can also convert binary numbers to other bases, such as decimal or hexadecimal.
In fact, it’s one of the operations you will perform the most
Well done!
Now you know the basics of the binary system and how it is used in computing. Keep practicing and exploring!