Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy Computer Basics Computer Languages Fundamentals of Computer Languages

Lee Ann Merrill
Lee Ann Merrill
1,103 Points

how do sequences of zeroes and ones (like in a byte) relate to the on/off switch concept?

I get that 0 = off and 1 = on, but how does that relate to the concept that a digit's place in a sequence tells you its value (like 111 = 13)?

2 Answers

Miroslav Kovac
Miroslav Kovac
11,454 Points

Hi,

111 is a binary number. What means that that it can be represented only with sequence of '0' and '1'. In standard world you normally uses a decimal numbers represented with sequences 0,1,2,3,4,5,6,7,8,9.

If you want to convert the binary number to decimal you can use this workflow: For example we have binary number of 1010:

begin from the end to start: (0 * (2 power 0)) + (1 * (2 power 1)) + (0 * (2 power 2)) + (1 * (2 power 3)) +

what is 0 * 1 + 1 * 2 + 0 * 4 + 1 * 8

so the result will be 10 as decimal number

When you make the same for 111 you will get that 111 = 7.

(1 * (2 power 0)) + (1 * (2 power 1)) + (1 * (2 power 2)) + what is 1 * 1 + 1 * 2 + 1 * 4 = 7

There is lot of stuff on internet about this topic.... (http://www.wikihow.com/Convert-from-Binary-to-Decimal)

Hope it helps little bit.

Lee Ann Merrill
Lee Ann Merrill
1,103 Points

Hi.....actually, my question really may be - does the analogy of 0/1 being like an on/off switch actually have any meaning or is it just an analogy? What do 0 and 1 tell the hardware to do?

Michael Afanasiev
Michael Afanasiev
Courses Plus Student 15,596 Points

Hi Lee,

Basically, 1's and 0's are translated into electrical signals and this guy explains it pretty good I think:

"In old computer you actually had a row of switches on the front panel that would allow entering 1s and 0s directly by hand in the registers of the machines. But this is no longer done.

You never have 1s and 0s, unless you ask the machine to print its internal information as a sequence of 1s and 0s. All information is already in the machine encoded as voltage, or magnetic orientation, or hole in a physical substrate, or some other physical form. Various devices can perform the translation between these form: magnetic heads, laser beams, electro-mechanical devices, electronic circuits,etc.

Some form are better adapted at memorizing or transmission by various means, while other (electrical signal notably) are better adapted at processing, usually by complex systems of logical gates (and, or, not, xor ...) and micro-memories (registers).

In general, binary/machine code is no longer entered by human beings, but produced by a program (usually a compiler) by the computer itself, or by another computer and then imported on some memory support or by network. However, human beings can ask to have it printed as 1s and 0s to check what the computer is using or producing. However this requires transforming the single bit 0 or 1 in the computer as a stream of bits to be interpreted by the printer as a request to print an actual drawing (on screen or paper) od the symbol representing a 0 or a 1. "

source: http://cs.stackexchange.com/questions/43336/who-converts-binary-machine-code-to-electrical-signals-and-how

Hope this helps!