# Unit #2-03

## Learning Outcome

At the end of this lesson, you will be able to:

• continue to understand what a variable is used for

## Review

• a variable is just a place to store information, that can change, hence the name
• we use them in math all the time
• in programming, we do not use a single letter to represent a variable, we use a word( or several words) to describe it
• ex: counter, numberOfStudents, totalCost, ...
• notice how we spell variable names

## Lesson

• making multiple variables to hold several pieces of information
• how the "digital" pins work on the Micro:Bit
• review how binary numbers are converted to decimal

## Activity

• show demo of "digital pins" on Micro:Bit
• show demo of my program
• go through logic in a flowchart

## Daily Assignment

• write a program that converts a 3-bit binary number to decimal
• use:
• pin 0 -> 4s
• pin 0 -> 2s
• pin 0 -> 1s
• create a variable to each of the binary place holders (fours, twos, ones)
• you will also need a variable for the decimalTotal
• place the code under "forever" for it to work correctly

## Extra

• if you finish early:
• when you press the "A" button, it clears all the pins to 0 again
• do not use pin "0,1,2" but pins "4,5,6,7" to create a 4-bit number (nibble)
• when you press the "B" button it shows the binary number and then the decimal value
• ex: "Binary 101 is 5 in decimal"