The basic computer method of storing information in a series of encoded zeros and ones - or bits. Binary is manipulated with Arithmetic and Boolean operations.

Binary based devices are what people mean when they commonly refer to Digital devices.

It is the system currently used in most computers, as well as the Artificial Intelligence of Robots. Many robots use <a a="" brain")="" class="wiki" for="" href="/wiki/microcontroller.html" robot"="" title="A programmable digital controller (or ">MicroControllers</a> to process their instructions. In fact, almost every gadget you have, mobile phone, PDA, and even a light switch could be said to operate using binary. Even BEAM Robots, which are based on analog electronics abuse digital logic devices to produce their behaviour.

## How does it work?

Imagine the Zero as representing an Off or False state, and One the On or True state - imagine a light bulb and switch for example. Since these are the two simplest states represented by any electronic circuit - it is not difficult to see why they were used for computing.
Now if you are then able to create a simple switch which acts upon a 1 or 0 input, changing the input of some other device - you are able to create more intelligent Boolean Logic Gates.

Also because of the high tolerances when only needing to detect two states, high transmission rates can be attained. At low rates it may arguably be quite inefficient use of a wire which can carry a huge continuous range of voltages - but when you are talking about millions of binary digits per second, then it become extremely efficient.

Analog describes the polar opposite of this system.

Also please refer to Parallel Data and Serial Data.

## Converting Binary To Decimal

If you have a multi-digit binary number, take each digit as being the presence or note of that places power of two. For example - reading from the right to left, the first digit will represent 2 to the power of zero. Any number to 0 is simply 1. So if it is on, you have 1, other wise 0. The next is 2 to the power of 1 - which simply gives 2 or 0. The 3rd digit will be 2 to the power of 2 - 4.

So - if you had the binary number 1101:

``` 1  1  0  1
+8 +4 +0 +1 = 13

1  0  1  1
+8 +0 +2 +1 = 11

1  0  1  0  1
+16+0 +4 +0 +1 = 21
```

You can represent any whole integer with this system - but you will require more digits as they get larger. The number of bits used is known as the Word Length, and at the time of writing is commonly 32, with some 64 and 128 bit buses occurring occasionally. The number of bits is also commonly a power of two itself - for keeping manipulation simple.

## Converting from Decimal to Binary

This is a little harder - but the given way is this, you find the largest power of two that will go into the number - and mark that as on. You then subtract it from the total, and do so again until you get to 0.

# Related Topics  Learn Robotics Programming: Build and control autonomous robots using Raspberry Pi 3 and Python 