Page 63 - Robo_Genius_V1.0_flipbook_C3
P. 63

• The micro:bit will show a heart image that changes size—getting big and
                    small—making it look like it’s beating.

                    • You can see how coding makes the heartbeat continuously, like a real heart

                    pumps blood.
                 You will understand how to create moving pictures (animations) using simple

                 computer code.

                 Application


                 You may have noticed the heartbeat animation on
                 a smart watch when using the heart monitoring
                 function.  This  animation  visually  represents

                 your pulse, syncing with the beats detected by
                 the watch’s sensors.




                 Understanding Variables in Programming

                 Variable:  A  variable  in  programming  is  like  a

                 special container that holds information, such as

                 numbers, words, or data. Think of it as a labelled
                 box where you store something you want to use

                 later. In coding, variables can store values that

                 can change while the program is running.

                    • This program uses a variable called ‘count’ to
                    keep track of the number you’re counting.

                    • It sets the variable to 0 at the start.

                    • Every time you press button B, it increases the count variable by 1 and shows

                    it on the LED display.

                    • Numbers over 9 won’t stay on the display, so pressing button A shows the

                    number.
                    • You can reset the counter by pressing buttons A and B together.











                                                                                 Programming with Micro:bit    61
   58   59   60   61   62   63   64   65   66   67   68