Binary To Decimal¶
Uses¶
LED Display
Description¶
In this challenge you will use your micro:bit to convert a binary number to a decimal.
In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically 0 (zero) and 1 (one). The base-2 numeral system is a positional notation with a radix of 2. Each digit is referred to as a bit.
Basic Task¶
- Create a binary number and store to a list.
- Use for loop to iterate through the list. Use
len()for the range. - Use
pop()to extract the last value on the list and convert it to a decimal value. Last value will have a value of 1(2^0), then 2nd to the last will have a value of 2``(2^1)``, the 3rd to the last will have a value on 4(2^2)etc. - Display the result on the LED screen.