BinaryNumbers

An app for the Kookaberry

Developed by
Tony Strasser

AustSTEM

This demonstrates how to convert decimal numbers to binary and vice versa. A 5-bit number is used in this demonstration.

Directions

Step 1: Setup

This app needs no peripherals.

Step 2: Running and using the app

Navigate to the BinaryNumbers app and press Button B to run. There  are three modes controlled by successive presses of Button B as follows.

Show:

The first screenshot on the left below is the default screen. The user can display the 5-bit binary equivalent of any given decimal number up to 31. The decimal number is selected by using Buttons C & D  – each increment and decrement the decimal number by 1.

Note that a 5-bit binary number can represent 32 different values of any measurement because “0” is a value in binary.

                   

In the second screenshot, the first binary digit, called a “bit” and reading from right to left, is 2 raised to the power 0 – which is decimal 1. The second is 2 raised to the power 1 – which is 2; the third is 2 raised to the power 2 – which is 4; the fourth is 2 raised to the power 3 – which is 8; and the fifth is 2 raised to the power 4 – which is 16.

These decimal numbers (1,2,4,8,16) are shown alongside the five binary digits. Add the decimal numbers together in the places where the “1” is showing in the binary number to obtain its decimal equivalent. In the second screenshot at top right above, binary 00101 is (0x16) + (0x8) + (1×4) + (1×1) =5

Dec:

Pick a random Decimal number (Left hand screenshot below) and write it down separately in binary. Check with”Show” (right hand screenshot)

               

Bin:

Pick a random Binary number (Left hand screenshot below) and write it down separately in decimal. Check with”Show” (right hand screenshot).

               

Open Questions

  1. What are the decimal number corresponding to a sixth, seventh, and eighth bit?
  2. What is an 8-bit digital “word” called?
  3. Why does an 8-bit digital “word” hold a special place in computing?
  4. How many levels can an 8-bit “word” represent?

Algorithm

  1. Set up variables
  2. Display static text
  3. Change the mode of operation between showing and solving numbers
  4. Adjust the numbers according to the mode using the C and D keys
  5. Random decimal, user solves binary
  6. Random binary, user solves decimal
  7. Compute the binary number from the decimal (default)

 

Learning plans that use this app

Version:1


Last updated:1 week ago


Device:Kookaberry


Radio code:


App ID:...


lib_dependencies:


root_dependencies:


Downloads

BinaryNumbers
BinaryNumbers.py


Download on GitHub
Image

Support

Issues resolved in the support forum:

8 out of 11
View support forum

Leave a Reply