SunFounder TS-10 10.1-inch Touch Screen
Conversion of binary numbers and decimal numbers.
Before programming the Enter sprite, let’s first understand the Binary number.
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).
How to convert binary to decimal?
For binary number with n digits:
dn-1 ... d3 d2 d1 d0
The decimal number is equal to the sum of binary digits (dn) times their power of 2 (2^n):
decimal = d0×2^0 + d1×2^1 + d2×2^2 + ...
If binary is 1000, the corresponding decimal should be 1x2^3+0x2^2+0x2^1+0x2^0=8
So, what is the decimal number of 1010? 1*2^3+0*2^2+1*2^1+0*2^0=10.
5.7. Scratch Projects 151