CyberPi: Game Controller
Block-Based: Beginner Description In this lesson, students will turn the CyberPi into a game controller by combining device programming and stage programming in mBlock. Students will examine example p

Lesson
Overview
Description
In this lesson, students will turn the CyberPi into a game controller by combining device programming and stage programming in mBlock. Students will examine example programs to discover how the CyberPi can control the movement of a sprite. Then, through pair programming, students will modify an existing game to program a CyberPi game controller.
Objectives
Differentiate between stage programming and device programming.
Examine and describe how an existing project functions.
Create a program in mBlock using the CyberPi to control sprites.
Modify an existing program.
Before the Lesson
Preparation
For the teacher and students:
Computer with mBlock 5 installed from here: https://www.mblock.cc/en/download/ or mBlock Web version
CyberPi with USB-C cable
Pocket shield (optional)
Example program(s): CyberPi – Lesson 5 – Chase Game & CyberPi – Lesson 5 – Space Adventures
Review
Warm Up
Video Game Discussion
1. Have students discuss the following with a partner:
Do you play video games? If so, how often?
What device or video game system do you prefer to play games on?
What’s your favorite video game controller?
What features make it your favorite?
Direct Instruction
Tour of mBlock 5
1. Open the mBlock software or mBlock 5 Web version.
2. Introduce students to the following key areas of the software interface:


Connect the CyberPi
3. Plug the CyberPi into the computer using the included cable. The CyberPi should boot up and the screen will display either the last program uploaded or the Home menu.
4. On the "Devices" tab in mBlock, click the "Add" button. Select CyberPi and click "Ok".
5. Click the "Connect" button. Then, select the USB port and click "Connect".

6. If connected successfully, the button will change to "Disconnect".

Guided Practice
Hands On
Explore Example Games
1. Assign students partners and determine who is Partner A and who is Partner B.
2. Instruct each student to open the appropriate example project:
Partner A: Lesson 5 – Chase Game
Partner B: Lesson 5 – Space Adventure
3. Have students connect the CyberPi in Live mode and play the game.
4. Each project combines stage programming and device programming to create an mBlock game that is controlled by the CyberPi. Explain the following to students:

5. Have students examine their assigned example program and differentiate between the stage programming and the device programming.
Note, device programming will be on the device(s) listed on the Devices tab and stage programming will be on the sprites and backdrops listed on the Sprites and Background tabs.
Abstraction and Decomposition
6. Students will be using computational thinking strategies, abstraction and decomposition, to examine the example projects and determine how to modify an existing game to add a CyberPi game controller. They will use abstraction to ignore or filter out parts of the program that are unnecessary to the challenge and use decomposition to break down the stage programming and device programming parts that are needed to create the controller.

7. Instruct students to carefully examine their assigned game and to complete the following challenge:


8. Through the exercise above, students should have discovered the following blocks:

Independent Practice
Try It
Pair Programming
1. Students will be working with a partner to add a CyberPi game controller to an existing project. Introduce students to the Pair Programming roles:

2. Have students switch roles every 3-5 minutes during the portion of the lesson.
Modify an Existing Project
3. Click Tutorials in the upper right corner. Select Example Programs.
4. Choose the Stage label to see example programs for the Stage.
5. While pair programming, have students choose an example program and modify the program scripts to add a game controller.
Extension
Have students research intellectual property, copyright, creative commons and citations.
Have students add a title and game instructions to the project.
Wrap Up
Wrap-Up & Quick Check
Respecting Intellectual Property
1. Discuss the importance of respecting intellectual property and providing credit to creators.
2. Have students add a comment to their project that provides credit. To add a comment, right-click on the script area and select Add comment.

Downloadable Material
Example Program
Educational Standards
CSTA
CSTA
2-AP-16: Incorporate existing code, media, and libraries into original programs, and give attribution.
ISTE
ISTE
2c: Students demonstrate an understanding of and respect for the rights and obligations of using and sharing intellectual property.
K12 CS Framework
K12 CS Framework
Practice 4-1: Identify complex, interdisciplinary, real-world problems that can be solved computationally.
Practice 7-3: Articulate ideas responsibly by observing intellectual property rights and giving appropriate attribution.
Alberta - Grade 6-8 - CTF
Grade 6-8
CTF
- Planning, creating, appraising and communicating in response to challenges.
- Working independently and with others while exploring careers and technology.
British Columbia - Grade 6-8 - ADST
Grade 6-7
ADST
• Generate potential ideas and add to others’ ideas
• Identify and evaluate the skills and skill levels needed, individually or as a group, in relation to a specific task, and develop them as needed
• Select, and as needed learn about, appropriate tools and technologies to extend their capability to complete a task
Grade 8
ADST
• Generate potential ideas and add to others’ ideas
• Make a plan for production that includes key stages, and carry it out, making changes as needed
• Identify and evaluate the skills and skill levels needed, individually or as a group, in relation to a specific task, and develop them as needed
• Select, and as needed learn about, appropriate tools and technologies to extend their capability to complete a task
Manitoba - Grade 6-8 - Science
Grade 6
Science (Overall Skills and Attitudes)
6-0-4a: Carry out procedures that comprise a fair test. Include: controlling variables; repeating measurements to increase accuracy and reliability.
6-0-4c: Work cooperatively with group members to carry out a plan, and troubleshoot problems as they arise.
Grade 7
Science (Overall Skills and Attitudes)
7-0-4a: Carry out procedures that comprise a fair test. Include: controlling variables, repeating experiments to increase accuracy and reliability
7-0-4c: Work cooperatively with team members to carry out a plan, and troubleshoot problems as they arise.
Grade 8
Science (Overall Skills and Attitudes)
8-0-4a: Carry out procedures that comprise a fair test. Include: controlling variables, repeating experiments to increase accuracy and reliability
8-0-4c: Work cooperatively with team members to carry out a plan, and troubleshoot problems as they arise.
New Brunswick - Grade 6-8 - Science
Grade 6-8
Science (Attitude Outcome)
425: show a continuing curiosity and interest in a broad scope of science-related fields and issues
430: persist in seeking answers to difficult questions and solutions to difficult problems
431: work collaboratively in carrying out investigations, as well as in generating and evaluating ideas
Newfoundland & Labrador - Grade 6-8 - Science
Grade 6-8
Science
GCO: Skills - Students will develop the skills required for scientific and technological inquiry, for solving problems, for communicating scientific ideas and results, for working collaboratively, and for making informed decisions.
Nova Scotia - Grade 6-8 - Mathematics & ICT/Technology
Grade 6
Mathematics
N09 Students will be expected to explain and apply the order of operations, excluding exponents, with and without technology (limited to whole numbers).
Performance Indicators:
N09.01 Demonstrate and explain, with examples, why there is a need to have a standardized order of operations.
N09.02 Apply the order of operations to solve multi-step problems with or without technology (e.g., computer, calculator).
PR03 Students will be expected to represent generalizations arising from number relationships using equations with letter variables.
Performance Indicators:
SCO PR03 Students will be expected to represent generalizations arising from number relationships using equations with letter variables. [C, CN, PS, R, V]
PR03.01 Write and explain the formula for finding the perimeter of any regular polygon.
PR03.02 Write and explain the formula for finding the area of any given rectangle.
PR03.03 Develop and justify equations using letter variables that illustrate the commutative property of addition and multiplication (e.g., a + b = b + a or a × b = b × a).
PR03.04 Describe the relationship in a given table using a mathematical expression.
PR03.05 Represent a pattern rule using a simple mathematical expression, such as 4d or 2n + 1.
ICT
P2: Students will be expected to use digital tools to develop ideas and original works in innovative ways.
TOC1: Students will be expected to
* safely use many forms of current technology for learning with growing competence
* demonstrate conceptual understanding of how information and communication technology, digital tools, and authorized networks support their learning
* use terminology related to information and communication technology
Grade 7
Mathematics
PR05 Students will be expected to evaluate an expression given the value of the variable(s).
Performance Indicator:
PR05.01 Substitute a value for an unknown in a given expression and evaluate the expression.
Technology
GCO1: Students will be expected to design, develop, evaluate, and articulate technological solutions
GCO2: Students will be expected to operate and manage technological systems
Grade 8
Technology
GCO1: Students will be expected to design, develop, evaluate, and articulate technological solutions
GCO2: Students will be expected to operate and manage technological systems
Ontario - Grade 6-8 - Mathematics
Grade 6
Mathematics
Algebra
C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves conditional statements and other control structures
Grade 7
Mathematics
Algebra
C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves events influenced by a defined count and/or sub-program and other control structures
Grade 8
Mathematics
Algebra
C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions
Prince Edward Island - Grade 6-8 - Science
Grade 6-8
Science
GCO: Skills - Students will develop the skills required for scientific and technological inquiry, for solving problems, for communicating scientific ideas and results, for working collaboratively, and for making informed decisions.
Quebec - Grade 6-8 - Science
Grade 6-8
Science (Strategies)
Exploring various ways of solving the problem
Exchanging information
Comparing different possible explanations for or solutions to a problem in order to assess them (e.g. full-group discussion)
Saskatchewan - Grade 6-8 - Science
Grade 6-8
Science (Goals)
Develop Scientific and Technological Skills – Students will develop the skills required for scientific and technological inquiry, problem solving, and communicating; for working collaboratively; and for making informed decisions.
