## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Computers

When computers talk to each other, they try to fulfill a given purpose in the simplest manner possible. In some contexts, that can be pretty simple indeed! For example, let’s look at the least complicated communications protocol: basic streaming. One computer talks nonstop and the other listens. This is the perfect solution for conveying simple data from one point to another as long as some errors can be tolerated. More complicated protocols will define whether there’s some kind of handshaking involved to set up the exchange, timing issues, what replies are sent in response to what messages, routing strategies, and so forth. But we don’t need to worry about any of that for now because we’re keeping it simple.

Let’s say we want to send a number between 0 and 255 to represent in real time how bright it is outside.

### Note

We use the range 0–255 because 255 is the largest number that can be represented in a single byte of data. All common forms of serial communication break data up into bytes. A byte is a set of eight digital bits. A single bit can be either 0 or 1, thereby representing two states. Add another bit and you now have four states: 00, 01, 10, and 11. A third bit allows for eight states (000, 001, 010, 011, 100, 101, 110, and 111), and so on and so forth until you get to eight bits that can represent 256 different states (including the zero state). That’s a byte! In decimal, the numbers go from zero to 255, and in hexadecimal notation they go from 0x0 to 0xFF. ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required