What are these?
Binary Clock ICE3M May 7, 2007 Ms. Nelson
Telling Time in Binary 1 or 0 2 or 0 4 or 0 8 or 0 16 or 0 32 or = 45 seconds! Similarly, the clock is currently showing = 12 for the hour, and = 7 for the minutes Therefore the current time is 12:07 and 45 seconds.
Computers and Storage Everything inside your computer is boiled down to tiny on/off switches Traditionally, we use 0 for off and 1 for on Ever noticed this on on/off switches? Numbers are stored this way too
Counting with 0’s and 1’s Pretend we only had 0’s and 1’s to work with, and not 2, 3, 4, 5, 6, 7, 8, 9. How many numbers can you come up with? 0, 1, 10, 11 (but not 12, 13, 14… have to skip all the way up to 99) 100, 101, 110, 111 1000…. can you continue this pattern?
Matching Up
The Power of the Powers of 2 1 (decimal) ≈ 1 (binary) ≈ 2 0 10 (decimal) ≈ 2 (binary) ≈ 2 1 100 (decimal) ≈ 4 (binary) ≈ 2 2 1000 (decimal) ≈ 8 (binary) ≈ 2 3 Any number can be expressed as a sum of powers of 2 e.g. 13 = = ≈ 1101 (bin) This is your shortcut!
Back to the Time It’s now 2:26 and 34 seconds How do we represent that? 2 becomes 10 26 becomes 34 becomes The current time is:
Your Task… Write a program in Turing that… Gets the current time from the system Look in the command reference for “Time” Prints it out to the console in binary format e.g., 2:26:34 prints out as: 10 Our next project will involve LED lights