Scrolling Text
Scrolling text across the display is a very useful way to get information from your micro:bit program. When you have your micro:bit on your cyber:bot robot, this is a good way to display values from the robot’s sensors.
To scroll text across the display, use the aptly named display.scroll method. The text you want to display goes inside quotation marks ” “, and that goes inside the method’s parentheses ( ).
Example project: hello
- Connect your micro:bit module to your computer with its USB cable.
- In a browser, go to makecode.microbit.org to open the micro:bit Makecode Editor.
- Enter and name the hello project.
(See Save & Edit Projects.) - Click Send to micro:bit.
(See Flash Projects with MakeCode Editor.)
You should see the word Hello scroll across the display one character at a time.
- Did you miss it? Press the reset button on the underside of the micro:bit module to see the Hello message repeat.
How the Hello Project Works
The only used block makes the text appear on the display. The “Hello” text in quotation marks is a parameter of the show string method, and so goes inside its parentheses.
Your Turn: Your Name
- Make a project to scroll your first name across the display.
- Modify your project to scroll your first name across the display wait 5 seconds, then scroll your last name across the display.