pxt-calliope/docs/lessons/speed-button.md

39 lines
1.6 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# speed button lesson
code a speed game by declaring Booleans on the @boardname@.
2016-03-26 00:47:20 +01:00
2016-05-27 00:24:10 +02:00
2016-03-26 00:47:20 +01:00
## Topic
Running Time
## Quick Links
2016-04-13 17:27:45 +02:00
* [activity](/lessons/speed-button/activity)
* [quiz](/lessons/speed-button/quiz)
* [quiz answers](/lessons/speed-button/quiz-answers)
2016-03-26 00:47:20 +01:00
## 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
2016-04-13 17:27:45 +02:00
* **running time** : [read more...](/reference/input/running-time)
2016-06-15 13:55:19 +02:00
* **variable** : [read more...](/blocks/variables)
* **Boolean** : [read more...](/blocks/logic/boolean)
2016-04-13 17:27:45 +02:00
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
2016-06-15 13:55:19 +02:00
* **if** : [read more...](/blocks/logic/if)
2016-04-13 17:27:45 +02:00
* **show string** : [read more...](/reference/basic/show-string)
2016-03-26 00:47:20 +01:00
## 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