Lesson 2 speed button lesson¶
code a speed game by declaring Booleans on the @boardname@.
Topic¶
Running Time
Quick Links¶
- speed button challenges
- speed button quiz
- Name
- Directions
- 1. What is a variable?
- 2. Draw which LEDs show the number being stored as a global variable called count
- 3. Draw which LED is ON after running this code and pressing Button A twice. Explain why you chose to draw that number
- 4. Draw which LED is ON after running this code and pressing Button A five times. Explain why you chose to draw that number.
- speed button quiz answers
- 1. What is a variable?
- 2. If the rectangle below represents the @boardname@, shade the area that shows the value of the variable count.
- 3. If the rectangle below represents the @boardname@, shade the areas that will be displayed after two button presses on Button A. Explain why that particular area is shaded.
- 5. If the rectangle below represents the @boardname@, shade the areas that will be displayed after five button presses on Button A. Explain why that particular area is shaded.
Prior learning/place of lesson in scheme of work¶
Learn how to declare a Boolean variable, var t:= true
var f:=false
for one of two possible values: true or false. We will be learning how to declare Boolean variables using global variables, if (conditionals), input on button pressed, input running time, as well as simple commands, such as input on button pressed, and show string.
Documentation¶
- **running time**
- **variable**
- **Boolean** :
- **on button pressed**
- **if**
- **show string**
Objectives¶
- learn how to get the number of milliseconds elapsed since the script began. 1,000 milliseconds = 1 second
- learn how to create a global variable to store data so that you can use it later in your code and will be accessible across functions and in nested code blocks
- learn how to create a Boolean with one of two possible values: true or false
- learn how to run code when an input button is pressed
- learn how to conditionally run code depending on whether a condition is true or not
- learn how to show a string on the LED screen one character at a time