Foundations of Technology
Introduction to Computer Science Principles byDesign
Unit 1: Computer Science Principles byDesign
Learning Cycle2 : Using Variables and Functions (Microbit)
Foundations of Technology
2
Big Idea
In this presentation we will learn how to use variables and functions in programming the microbit to solve engineering problems.
Foundations of Technology
3
What is a variable?
Foundations of Technology
4
When we create a variable, we can:
5
Initializing a Variable
6
Incrementing a Variable by 1
7
Showing/displaying the current value of the variable
8
Using variable in math operations
9
Your turn:
Create two variables that can be updated and the current values shown in the microbit display when a button is pressed.
10
Functions
Foundations of Technology
11
Examples of built-in function
12
The function block
Foundations of Technology
13
Naming the function
14
Naming a function
15
Functions must be called to be executed.
16
Functions can be with/without parameters (Input)
Function without parameter
Foundations of Technology
17
Functions can be with/without parameters (Input)
Function with parameter
Foundations of Technology
18
For movements, utilize the servo simulation
Foundations of Technology
19
Your turn:
Foundations of Technology
20