EasyManua.ls Logo

SunFounder TS7-Pro - Page 182

Default Icon
235 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
TS7-Pro 7-inch Touch Screen
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.
Programming the Backdrop
When the game starts, a random integer between 1-16 appears in the middle of our screen as a decimal number that
needs to be converted by binary, and it is stored in the variable random.
Whether we receive a “right” result or a “wrong” result, we have to regenerate the random number and proceed to the
next round of the game.
178 Chapter 5. PROJECTS AND ACTIVITIES

Related product manuals