Please login to send this document by email!
37. © education.makeblock.com 37 2. Some solutions may, at first, ap pear to be correct. But, encour age students to think critically and fully test their solution. For example, the following code does not p roperly graph the data. When testing this code, you should observe that speaking loudly by the CyberPi ma kes both the red and blue lines increase. 3. Encourage students to persevere t hrough fixing or debugging the ir code until they get the correct solution. The following is a correct solution: Wrap‐Up [5 minutes] Documentation
44. © education.makeblock.com 44 2. Students may find it helpful to add the following script inside the forever loop to s ee the values of the variables on the CyberPi display: Wrap‐Up [5 minutes] Variable Review 2. Discuss with students how variab les are used to store informati on in a variety of computing devices and applications. Discuss the following examples with students:
7. © education.makeblock.com 7 1. Facilitate a discussion for students to share about their favor ite example projects. Encourage students to identify the CyberPi features and capabilities they are most excited to learn about. 2. Have students document what they hope to learn while completing these lessons and any questions they may have. 3. Now that students have seen some examples of the CyberPi in act ion, encourage them to brainstorm ideas for a problem i n their daily life that they wa nt to solve using the CyberPi and mBlock. Lesson Extension(s) If students need additional support using mBlock, consider havi ng the students complete the mBlock 5 Getting Started Activities.
26. © education.makeblock.com 26 Project Documentation 1. Now that students have created a feature‐rich sound recorder, h ave them write a description for their recorder that explains the features they have included in their design. Lesson Extension(s) Have students collect feedback f rom a variety of stakeholders ( i.e., parents, teachers, friends, etc.). Have students add improvements t o a different student’s project .
38. © education.makeblock.com 38 1. When programming, it can be help ful to document programs to mak e them easier for someone to follow, test and debug. Often, multiple programmers work on one project. Instruct students to use a comment(s) to explain how the code works. Lesson Extension(s) Have students program the LEDs or speaker to react to the loudn ess or light intensity. Have students add a title and ga me instructions to the project. Have students program a sprite or background to change costumes based on the loudness or light intensity. (Note, a variable is required to store each sensor v alue.)
22. © education.makeblock.com 22 [5 minutes] Summarize 1. Have students share a few of the ideas they incorporated into t heir sound records. 2. Remind students that t he next activity will have them continue developing the Sound Recorder project through an iterative process. Lesson Extension(s) Have students explore UX Design (User Experience Design) and th e role it plays in software development. Have students research accessibili ty and usability with softwar e development.
10. © education.makeblock.com 10 Activities Warm‐Up [5 minutes] Input vs. Output 3. Discuss the following defini tions with the students. Term Definition* input A device or component that allows information to be given to a computer. output Any device or component that receives information from a computer. *Definitions from Co de.org – CSD Unit 1 4. Using a smartphone as an exampl e, have students work in pairs or small groups to create a list of the input and output for a mobile phone. Some examples may include: Smartphone Input Output Microphone Touch Screen Buttons GPS Motion Sensor (tilting the phone) Light Sensor Camera Internet connection Temperature Sensor Charging Port Bluetooth Speaker Screen / Display Headphones Vibration Internet connection LED (flashlight / camera flash) Charging Port Bluetooth 5. Have students reflect on Lesson 1 – Meet the CyberPi and create a list of the input and output for the CyberPi. Encourage students to r efer back to the product docume ntation included with the CyberPi if they get stuck. CyberPi
55. © education.makeblock.com 55 when a specific cloud broadcast is received. Sends a cloud broadcast. The CyberPi can communicate with a Halocode or an mBlock sprite through Wi‐Fi cloud broadcast. Halocode See description of CyberPi blocks above. Sprite See description of CyberPi blocks above. LAN A LAN (local‐area network) is a network that links a group of c omputers or devices within a certain location. The group of c omputers share communications t o send messages to each other. A local area network can be formed between CyberPi’s to allow one CyberPi to control another. Category Block Function Event block that triggers the execution of the actions attached when a specific LAN broadcast is received. Sends a LAN broadcast. 10. Select the type of communication that will work for with your c lassroom and students. Use the following steps as an example o f how wireless communication wor ks in mBlock.
20. © education.makeblock.com 20 Starts recording audio. Limited to a 10 second recording. Stops recording audio. Plays the last recording stored on the CyberPi. 24. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Live mode. 25. Remind students how to drag‐and‐drop blocks from the color‐code d categories in the Block Area. Instruct students to build the f ollowing scripts and test the p rogram: 26. Ask students if the device is ready to give to the classmate to use in their foreign language class. Many students will begin to identify areas of improvement for this d esign. Have students brainstorm and create a list of ways to improve this basic sound recording dev ice. If students need additional guidance, consider asking the following questions: a. How will your classmate know how to use the CyberPi Sound Recor der? b. How will your classmate know i f the CyberPi is recording? c. What other features could be useful for your classmate? d. What other components of the Cybe rPi can be used to create a mo re feature‐rich solution? (i.e., display, LED strip, speaker, motion sensor) Try It [20 minutes] Plan and Create Sound Recorder 2.0
12. © education.makeblock.com 12 When middle joystick button is pressed: Stop all sounds and lights 21. Have students examine the pseudocode above and identify the inp ut and output for the program. Sound Machine Project Input Output Button A Button B Joystick Middle Button Speaker / Buzzer LED(s) Write the Program 1. Now that the program is planned, it is time to learn about the new blocks needed to program the pseudocode. Category Block Function Specifies the action on the CyberPi that triggers the execution of the actions attached. Loop Statement Continuously execute the actions nested inside the block. Stops all scripts, including all loops. Play a note on the CyberPi buzzer for a specified amount of time. Frequency Range: 0 to 1000 Light all or an individual on‐board LED a specified color. Color Value Range: 0 to 255
57. © education.makeblock.com 57 1. Using the following problem statement, instruct students to pla n a solution to the problem. There are many ways to solve this problem; one sample solution has been p rovided for you. Gift Alarm Problem One of your friend’s birthday is soon. This friend likes to sha ke presents to try to figure out what is inside. You would like to figure how to make a silent alarm that will notify you wirelessly if t he gift is shaken. How can mBlock, the CyberPi a nd/or the Halocode help you determine if your frie nd shakes the present you give them this year? Proposed Solution Program the Halocode to send a cloud message if it is shaken. Secure the Halocode and a batt ery pack inside the present before wrapping. Program the CyberPi to play a so und and flash LEDs if a cloud message is received indicating the gift was shaken. Bonus: Have a sprite in mBlock also shake when the gift is shaken. 2. Have students write pseudocode for the Gift Alarm and then create the project using their pseudocode as a guide. Wrap‐Up [5 minutes] Brainstorming Ideas
43. © education.makeblock.com 43 greater than the second value. Returns TRUE or FALSE. 16. Instruct students to build the following scripts and test the program to observe the joystick up/down controls increasing the red value of all of the LEDs: Using a Conditional Statement 17. Remind students that the R, G, B values have a range of 0 to 25 5. With the program above, the redValue variable can be changed to a va lue that falls outside of that range. We can use conditional statements to control the minimu m and maximum values. Instruct students to modify the code and add the following conditional statements to the program: Note, students can also add a block to set the brightness to 10 0% when the program starts. 18. Explain to the students how the conditional statements do not a llow the redValue to ever be greater than 255 or less than 0. Try It [20 minutes] Completing the Program 1. Instruct students to finish the program based on the pseudocode provided earlier in the lesson. The following is an example of a completed program:
14. © education.makeblock.com 14 Computer or CyberPi selects a random value between the specified range. 8. Modify the previous programs to include the following random bl ocks: Note, these ranges correspond to the range of values accepted f or each block. 9. Have students test the new progr am. Note, students can change t he seconds value in the play buzzer block to a decimal if they wou ld like a faster buzzer sound. Restart a CyberPi 10. Programming a button to restart the CyberPi can be a helpful to ol in upcoming lessons. So, guide students through programming a b utton to manually restart the C yberPi. Category Block Function Restarts or reboots the CyberPi device. The CyberPi will play the last program uploaded to the device. 11. Instruct students to build the following script and test the pr ogram: Try It [20 minutes] Create a Sound Machine 3. Provide students time to experiment with their existing code. E ncourage them to try different values for the parameters in the blocks.
19. © education.makeblock.com 19 22. Using the following problem stat ement, guide students through p lanning a solution to the problem. A sample solution has been provided for you. Note, keep the initi al solution very simple. This will allow for students to iterate and add features as they work on develo ping a feature‐rich sound recorder. Sound Recorder 1.0 Problem One of your classmates is taking a foreign language class. They would like to practice their pronunciat ion of some of the vocabulary learned in class, but by the time they g et home, they forget how their teacher said the words. How can the CyberPi be used to h elp your classmate with this problem? Proposed Solution Create a sound recording using t he CyberPi t o record the teacher pronouncing the words and then playback the recording when studying at home. Pseudocode When Button A is pressed: Start recording When the middle joystick button is pressed: Stop recording When Button B is pressed: Playback recording Create Sound Recorder 1.0 23. Now that the program is planned, it is time to learn about the new blocks needed to program the pseudocode. Category Block Function
36. © education.makeblock.com 36 Stores a numerical value representing the volume detected by the sound sensor on the CyberPi. Charting the Sound Sensor 6. Introduce students to the blocks that are for creating a line c hart on the CyberPi: Category Block Function Plots a point on the line chart on the CyberPi display. Changes the horizontal spacing of the line chart. Sets the color of the line chart. 7. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Live mode. 8. Instruct students to build the following script and test the pr ogram: Try It [20 minutes] Charting the Light Sensor 1. Challenge students to modify the code to include a red line cha rt for the light intensity. The CyberPi should show both charts at the same time.
49. © education.makeblock.com 49 Category Block Function Loop Statement Execute the actions nested inside the block until a condition is TRUE. Sets the timer on the CyberPi to zero (0). Returns a value representing how strong the CyberPi is shaken. Displays text on the CyberPi display at a specified position and size. 4. Instruct students to build the f ollowing scripts and test the p rogram to observe th e shaking strength values: Keeping Score 5. Make a variable named score and leave For all sprites selected.
58. © education.makeblock.com 58 4. Wireless communication and cloud messages eliminate barriers su ch as cord length and device location. With the cla ss, brainstorm a list of ideas for progra ms that could benefit from wireless communication. Some ideas may include: Weather station which reports to a separate device. Survey collection device in a ma in location of the school which reports results to the classroom. Walkie talkie or text me ssaging between devices. Lesson Extension(s) Have students develop their own project using wireless communic ation. Have students research networks and the role they in society.
3. © education.makeblock.com 3 Activities Warm‐Up [5 minutes] Meet the CyberPi 1. Guide students through an unboxi ng of the CyberPi. Show the stu dents the following components and have students locate them in their CyberPi Kit: a. CyberPi b. USB‐C Cable c. Pocket Shield (not included in Base Kit) d. mBuild Sensors (not included in Base Kit) 2. Have students read the CyberPi box and the Quick Start Guide. T hen, have students write a short summary listing what they have le arned so far about the feature s and capabilities of the CyberPi. Hands‐On [15 minutes] Tour of mBlock 5 1. Open the mBlock 5 software or mBlock 5 Web version . 2. Introduce students to the following key areas of the software i nterface:
11. © education.makeblock.com 11 Input Output Microphone Buttons (A, B & Home) Joystick Charging Port Bluetooth Motion Sensor (gyro) Light Sensor Volume/Sound Sensor Speaker Screen / Display LED Strip Indicator LED (shows charging & power on) with Pocket Shield and mBuild Kit Multi‐Touch Sensor Slider Ultrasonic Sensor Third‐Party Sensors Motors (encoder & servo) LED Strip Third‐Party Modules Hands‐On [15 minutes] Plan a Program with Pseudocode 19. Discuss with the students the im portance of planning a program before developing it in the software. Introduce student to pseudocode which can be a helpful tool for planning an mBlock project. Term Definition pseudocode Written sequence of steps for a p rogram written in English or the programmer’s native language. 20. Using the following project description, guide students through writing the pseudocode for the project. Sound Machine Project Description Create a project where the CyberPi continuously makes sound wit h the A button and lights up the LEDs with the B button. Have the middle joystick button sto p the sounds and lights. Pseudocode When Button A is pressed: Forever set all the LE Ds a specified color When Button B is pressed: Forever Play the buzzer at a specified note
48. © education.makeblock.com 48 Activities Warm‐Up [5 minutes] Variable Review 30. Review variables with the class and explain how variables can b e used to keep track of a score in an mBlock project. Review with students how to create a variable, set a variable and change a variable in mBlock. Hands‐On [15 minutes] Detecting Strength 1. Review the following challenge and pseudocode with the students : Strength Meter 1.0 Project Description Create a game where the user shakes the CyberPi for 10 seconds and earns a point for every time the shaking strength exceeds 50. Pseudocode When Button B is pressed: Set the score to zero (0) Reset the timer Repeat for 10 seconds If shaking strength is greater than 50 then, Change the score by one (1) When Button A is pressed: Show the score on the CyberPi display 2. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Live mode. 3. Introduce students to th e following new blocks:
21. © education.makeblock.com 21 1. Explain to students that programmers and software developers im prove upon their solutions often. (Note, this is why software apps have updates and redesigns.) S oftware development is an iterative process. 2. Using the list of improvements they created in the previous sec tion, have students identify the three most important features they would like to add to the Sound Recorder program. 3. Have students describe and justify the features they will be ad ding. Then, have students write the pseudocode for each feature. A sample plan is provided below: Sound Recorder 2.0 Feature #1 Add instructions to the display telling the user what buttons to press to control the CyberPi Sound Recorder. When the CyberPi starts up: Display on the screen: “Press A to start, Press joystick to stop, Press B to play” Feature #2 Use the LEDs to tell the user when the CyberPi is recording. When Button A is pressed: Set all LEDs to display green Start recording When the middle joystick button is pressed: Set all LEDs to display red Stop recording When Button B is pressed: Set all LEDs to display blue Playback recording Feature #3 Add the ability to change the CyberPi’s volume. When the CyberPi starts up: Set the volume to 50% When the joystick is pulled up: Increase the volume by 10% When the joystick is pulled up: Decrease the volume by 10% Note, there are two example prog rams included with this lesson. These should be for the teacher to review. Students should be encouraged to brainstorm and create a program from their own ideas. 4. Have students create the Sound Recorder 2.0 using their pseudocode as a guide. Wrap‐Up
45. © education.makeblock.com 45 Fitness trackers stores the number of steps. Automobiles (with a digital disp lay) stores the number of miles driven. Mobile devices stores the batter y level and reports it as a per centage. Store shopping cards store the number of visits until you earn a reward. Video games store healt h, lives and scores. Lesson Extension(s) Have students add a title and instructions to the project. Have students create a variable for the LEDNumber and use the m iddle joystick button to control which LED is being changed.
15. © education.makeblock.com 15 4. Challenge students to explore other blocks in the LED and Audio categories in the Block Area. Some blocks of interest may be: 5. Once they’ve explored the various blocks. Have students write p seudocode for an enhanced version of the Sound Machine project. 6. Have students create their proje ct using their pseudocode as a guide. Wrap‐Up [5 minutes] Project Showcase 4. Group students into pairs and have students present their Cyber Pi Sound Machine to their partner. 5. Have students ask each other the following questions: a. What feature of your project are you most proud of? b. What was most challenging about this project? Lesson Extension(s) Program a stop button using the Repeat Until block with the blo ck. Use the joystick buttons to prog ram multiple different sounds a nd light shows.
56. © education.makeblock.com 56 11. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Upload mode. 12. On the Panda sprite, in the Block Area , click the button. Find the User cloud message extension and click +Add . 13. Instruct students to build the following scripts: CyberPi Sprite 14. Update the Wi‐Fi ssid and password with the information for the wireless router in your location for the CyberPi to connect. 15. Upload the program to the CyberPi and test the program. Students should observe Panda walk when the CyberPi is shaken. 16. If the program does not appear to work, add the following code to the CyberPi script to troubleshoot the Wi‐Fi connection. Try It [20 minutes] Creating a Gift Alarm
13. © education.makeblock.com 13 Turns off all or an individual on‐ board LED. 2. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Live mode. 3. Remind students how to drag‐and‐drop blocks from the color‐code d categories in the Block Area. Instruct them to build each of the following scripts: Note, the middle pressed option can be found on the drop‐down menu. 4. Test the program in Live mode and/or Upload mode. 5. Have students experiment with different values for the buzzer a nd LED blocks to observe how the CyberPi performs. 6. Extension: If time permits, teach students about RGB color values. Or, all ow them to use a color picker to identify the RGB valu es of specific colors. Randomizing the Output 7. In the code above, a specific buz zer frequency and RGB color va lue were programmed in the code. The CyberPi is repeating the same sound and same LED color forever. The following block can be used to allow the program to select a random value each time the foreve r loop repeats. Category Block Function
50. © education.makeblock.com 50 6. Instruct students to add the foll owing scripts to the program: 7. Now that the CyberPi is keeping track of the score, add the fol lowing scripts to display the score on the screen with button A is pressed: 8. Have students play the game and see how many points they can ea rn. Try It [20 minutes] Creating Strength Meter 2.0 3. With a simple version of a Strength Meter ga me created, there a re many improvements that can be added to the program. Have students identify areas of improveme nt for this design. Some ideas for improvement include: o Use the LED Strip to inform the user when the game is running. o Add a sound effect each time a point is earned. o Add a sound effect when time runs out. o Add a title and instructions. o Use the joystick and a variable t o change the difficulty of the game (i.e., shaking strength for easy is 30, medium is 50 and hard is 70). 2. Have students develop a plan and pseudocode for the improvement s they would like to add to their project.
51. © education.makeblock.com 51 3. Have students create the Strength Meter 2.0 using their pseudocode as a guide. Wrap‐Up [5 minutes] Motion Sensing 3. The CyberPi has a 3‐axis gyrosco pe and a 3‐axis accelerometer w hich detects motion, acceleration and vibration. The shaking strength block uses this component to de termine how strong the CyberPi is being shaken. Have students brai nstorm a list of devices they u se that use a gyroscope. Some examples may include: Mobile phones change the screen o rientation based on device rot ation. Screens on mobile phones light u p when the device is picked up. Video game controllers detect motion. Robotic vacuums detect if they have fallen or tipped over. Lesson Extension(s) Have students program the LEDs to progress ively light up based on the strength (see example). Have students program a 2‐player game where it tracks a score f or both players, compares the scores and declares a winner.
32. © education.makeblock.com 32 *Definitions from Code.org – CSD Unit 1 6. Have students switch roles every 3‐5 minutes during the portion of the lesson. Modify an Existing Project 7. Click Tutorials in the upper right corner. Select Example Programs . 8. Choose the Stage label to see example programs programs for the Stage. 9. While pair programming, have students choose an example program and modify the program scripts to add a game controller. Wrap‐Up [5 minutes] Respecting Intellectual Property 3. Discuss the impo rtance of respecting intellectual property and providing credit to creators. 4. Have students add a comment to their project that provides cred it. To add a comment, right‐click on the script area and select Add comment. Lesson Extension(s) Have students research intellect ual property, copyright, creati ve commons and citations. Have students create a new game that incorporates stage program ming and device programming. Have students add a title and ga me instructions to the project.
24. © education.makeblock.com 24 Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Content Standards Type Indicator Standard CSTA 2‐IC‐22 Collaborate with many contributo rs through strategies such as crowdsourcing or surveys when cr eating a computational artifact . CSTA 2‐CS‐1 Recommend improvements to the de sign of computing devices, base d on an analysis of how users interact with the devices. K12 CS Framework Practice 2‐3 Solicit and incorporate feedback f rom, and provide constructive feedback to, team members and other stakeholders. K12 CS Framework Practice 3‐1 Identify complex, interdisciplinary, real‐world problems that c an be solved computationally. K12 CS Framework Practice 5‐1 Plan the development of a comput ational artifact using an itera tive process that includes reflection on and modification of the pla n, taking into account key features, time and resource constraints, and u ser expectations. K12 CS Framework Practice 6‐1 Systematically test computational artifacts by considering all scenarios and using test cases. K12 CS Framework Practice 6‐2 Identify and fix e rrors using a systematic process . K12 CS Framework Practice 6‐3 Evaluate and refine a computatio nal artifact mul tiple times to enhance its performance, reliability, u sability, and accessibility. Agenda (45 minutes) Duration Content 15 minutes Warm‐up Collect Peer Feedback 20 minutes Try It Plan and Create Sound Recorder 3.0 10 minutes Wrap‐up Project Documentation Lesson Extension(s) Activities Warm‐Up [15 minutes]
35. © education.makeblock.com 35 27. Find a current event about smart home devices to present to the class. Discuss how these solutions use sensors to provide security, con venience and automation for con sumers. Hands‐On [15 minutes] Exploring Sensor Data 1. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Live mode. 2. Open the Lesson 6 – Sensor Meter example project . Click the Gre en Flag to run the program. Observe the values for the CyberPiVolu me and CyberPiLightIntensity. 3. Have students run the program and observe the sensor values and graphing in differe nt scenarios, such as: CyberPi sitting on the desk Covering up the CyberPi (light intensity should decrease) Shining a flashlight on the CyberP i (light intensity should dec rease) Trying to be as quiet as possi ble (volume should decrease) Clapping or talking near the Cyb erPi (volume should increase) 4. Challenge students to determine the minimum and maximum values the sensors report to the computer. Note, the Light sensor and Sound sensor have a range of 0 to 100. 5. Introduce students to the blocks that are used for the sensors on the CyberPi: Category Block Function Stores a numerical value representing the light intensity detected by the light sensor on the CyberPi.
54. © education.makeblock.com 54 Activities Warm‐Up [5 minutes] Internet of Things 31. Facilitate a short rese arch activity on the Internet of Things. Have students research and present their findings. Their research should lead them to learn more about h ow internet‐connected physical computing devices are used i n the following applications: a. Smart Homes b. Healthcare Monitoring c. Transportation d. Agriculture e. Weather f. Manufacturing g. Environmental Research h. Military Hands‐On [15 minutes] Wireless Communication in mBlock 9. There are two types of wireless communication in mBlock: Wi‐Fi and LAN. Review the following information and blocks for each type. Wi‐Fi Using a Wi‐Fi connection, data is shared with the cloud message function. You can share data across devices and projects with the same mBlock 5 account. Phy sical proximity or distance is no longer a restriction, as these devices do not need to be in the same location. To use, each device must be connected to the internet. See the blocks below for connecting the CyberPi, Halocode and the mBlock project to cloud messages. Category Block Function Connects the CyberPi to a wireless network. Returns TRUE if the CyberPi is connected to the internet. Event block that triggers the execution of the actions attached
30. © education.makeblock.com 30 Abstraction and Decomposition 6. Students will be using computational thinking strategies, abstr action and decomposition, to examine the example projects and determine how to modify an existing ga me to add a CyberP i game controller. They will use abstraction to igno re or filter out parts of the program that are unnecessary to the challenge and use decomposition to break down the stage program ming and device programming parts that are needed to cre ate the controller. Term Definition abstraction Simplify a problem by hiding , filtering out or ignoring unnecessary details. decomposition Break a problem down into smaller pieces. 7. Instruct students to carefully e xamine their assigned game and to complete the following challenge: Game Controller Problem You are tasked with taking an existing program and adding a Cyb erPi game controller. Use the example program to learn how to comple te this task. Challenge Write a comprehensive explanation of how the CyberPi and the st age interact in the example game. Computational Thinking Abstraction Encourage students to use abstr action to filter out unnecessary parts of the programs that are n ot interacting with the CyberPi . Some examples include: Space Game o The Title, ball, asteroids and health sprites o The background o The “when I receive gameStart” scripts Chase Game o The Title and Bat sprites
31. © education.makeblock.com 31 o The background o The “when I receive gameStart” scripts Decomposition Encourage students to decompose the parts of the program. Be sure students include specifics such as: o Which buttons on the CyberPi are being used? o Which sprites are being controlled? o How do the buttons on the CyberPi control the sprites? 8. Through the exercise ab ove, students should have discovered the following blocks: Category Block Function Send a message from one device, sprite or background to another. Used to synchronize actions. Conditional Statement Executes the actions nested inside if a condition is met. Used with a conditi onal statement to detect whether the joystick is pressed or moved by the user. Try It [20 minutes] Pair Programming 5. Students will be working with a partner to add a CyberPi game c ontroller to an existing project. Introduce students to the Pair Programming roles: Pair Programming Navigator Keeps track of the big picture a nd helps to decide what to do n ext. Driver The person using the comput er actually writing the code.
42. © education.makeblock.com 42 When the joystick is pulled down: Decrease the red (R) value of all LEDs by 5 When the joystick is pulled right: Increase the green (G) value of all LEDs by 5 When the joystick is pulled left: Decrease the green (G) value of all LEDs by 5 When Button A is pressed: Increase the blue (B) value of all LEDs by 5 When Button B is pressed: Decrease the blue (B) value of all LEDs by 5 11. To program this project, a variable must be used to store the v alue of each of the LEDs. The variables will start at zero (0) when the C yberPi starts and will be adju sted using the joystick or buttons. 12. Open the mBlock 5 software or mBlock 5 Web version . Add the CyberPi in the Devices tab and connect in Live mode. 13. Go to the Variables section of the Block Area . Click the Make a Variable button. 14. Name the new variable redValue and leave For all sprites selected. 15. Introduce students to the following new blo cks which are now av ailable in the Variables section: Category Block Function Sets a variable to a specific value. Changes a variable by a specific value (positive or negative). Returns the current value stored in the variable. Compares two values and determines if the first value is less than the second value. Returns TRUE or FALSE. Compares two values and determines if the first value is
17. © education.makeblock.com 17 Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Content Standards Type Indicator Standard CSTA 2‐CS‐1 Recommend improvements to the de sign of computing devices, base d on an analysis of how users interact with the devices. K12 CS Framework Practice 3‐1 Identify complex, interdisciplinary, real‐world problems that c an be solved computationally. K12 CS Framework Practice 5‐1 Plan the development of a comput ational artifact using an itera tive process that includes reflection on and modification of the pla n, taking into account key features, time and resource constraints, and u ser expectations. K12 CS Framework Practice 6‐1 Systematically test computational artifacts by considering all scenarios and using test cases. K12 CS Framework Practice 6‐2 Identify and fix e rrors using a systematic process . K12 CS Framework Practice 6‐3 Evaluate and refine a computatio nal artifact multiple times to enhance its performance, reliability, u sability, and accessibility. Agenda (45 minutes) Duration Content 10 minutes Warm‐up Evolving Computing Solutions 10 minutes Hands‐on Make a Plan Create Sound Recorder 1.0 20 minutes Try It Plan and Create Sound Recorder 2.0 5 minutes Wrap‐up Summarize Lesson Extension(s) Activities
34. © education.makeblock.com 34 CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 6 – Sensor Meter Content Standards Type Indicator Standard CSTA 2‐AP‐19 Document programs in order to ma ke them easier to follow, test, and debug. CSTA 2‐CS‐03 Systematically identify and fix problems with computing devices and their components. ISTE 5b Students collect data or identify relevant data sets, use digit al tools to analyze them, and represent data in various ways to facilitate problem‐ solving and decision‐making. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Data and Society 15 minutes Hands‐on Exploring Sensor Data Charting the Sound Sensor 20 minutes Try It Charting the Light Sensor 5 minutes Wrap‐up Documentation Lesson Extension(s) Activities Warm‐Up [5 minutes] Data and Society
40. © education.makeblock.com 40 CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 7 – Color Mixer Content Standards Type Indicator Standard CSTA 2‐CS‐02 Design projects that combine hardware and software components t o collect and exchange data. CSTA 2‐AP‐11 Create clearly named variables t hat represent different data ty pes and perform operations on their values. CSTA 2‐DA‐07 Represent data usin g multiple encoding schemes. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Conditional Statements Game 15 minutes Hands‐on Storing Data with a Variable Using a Conditional Statement 20 minutes Try It Completing the Program 5 minutes Wrap‐up Variables Lesson Extension(s)
29. © education.makeblock.com 29 Warm‐Up [5 minutes] Video Game Discussion 1. Have students discuss the following with a partner: o Do you play video games? If so, how often? o What device or video game system do you prefer to play games on ? o What’s your favorite v ideo game controller? o What features make it your favorite? Hands‐On [15 minutes] 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: o Partner A Lesson 5 – Chase Game o Partner B Lesson 5 – Space Adventure 3. Have students connect the CyberPi in Live mode and play the gam e. 4. Each project combines stage programming and device programming to create an mBlock game that is controlled by the CyberPi. Expla in the following to students: Term Definition stage programming Sequences of programming blocks that interact with the sprites and background of the stage in mBlock. device programming Sequences of programming bloc ks that interact with the physical computing device(s) connected in mBlock. 5. Have students examine their assi gned example program and differ entiate 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.
53. © education.makeblock.com 53 Computer with mBlock 5 installed or mBlock Web version Two (2) CyberPi’s with USB‐C cable or One (1) CyberPi and One (1) Halocode Pocket Shield (optional) Example program(s): CyberPi – Lesson 9 – Gift Alarm Content Standards Type Indicator Standard CSTA 2‐AP‐13 Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs. ISTE 5c Students break problems into component parts, extra key informa tion, and develop descriptive models to understand complex systems or facilitate problem‐solving. K12 CS Framework Practice 3‐1 Identify complex, interdisciplinary, real‐world problems that c an be solved computationally. K12 CS Framework Practice 3‐2 Decompose complex real‐world pro blems into manageable subproble ms that could integrate existing solutions or procedures. K12 CS Framework Practice 3‐3 Evaluate whether it is appropria te and feasible to solve a prob lem computationally. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Internet of Things 15 minutes Hands‐on Wireless Communication in mBlock 20 minutes Try It Creating a Gift Alarm 5 minutes Wrap‐up Brainstorming Ideas Lesson Extension(s)
47. © education.makeblock.com 47 Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 8 – Strength Meter Content Standards Type Indicator Standard CSTA 2‐CS‐02 Design projects that combine hardware and software components t o collect and exchange data. CSTA 2‐AP‐11 Create clearly named variables t hat represent different data ty pes and perform operations on their values. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Variable Review 15 minutes Hands‐on Detecting Strength Keeping Score 20 minutes Try It Creating Strength Meter 2.0 5 minutes Wrap‐up Motion Sensing Lesson Extension(s)
16. © education.makeblock.com 16 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Create a program in mBlock that records and playbacks audio. Follow an iterative process to develop a solution to a computin g problem. Overview By combining the speaker, microp hone and integrated storage, st udents will transform the CyberPi into a pocket‐ sized audio recorder and playback device. Through an iterative process, students will evaluate their projects and improve their sound recorders. Key Focus Record audio with the CyberPi Play recordings Use an iterative design process Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 3 – Sound Record er 1 CyberPi – Lesson 3 – Sou nd Recorder 2 For the student: Lesson 3 Sound Recorder
9. © education.makeblock.com 9 Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Content Standards Type Indicator Standard CSTA 2‐AP‐10 Use flowcharts and/or pseudocode to address complex problems as algorithms. K12 CS Framework Practice 5‐2 Create a computational artifact for practical intent, personal expression, or to address a societal issue. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Input vs. Output 15 minutes Hands‐on Plan a Program with Pseudocode Write the Program Randomizing the Output Restart a CyberPi 20 minutes Try It Create a Sound Machine 5 minutes Wrap‐up Project Showcase Lesson Extension(s)
23. © education.makeblock.com 23 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Provide constructive feedbac k on a computing solution. Modify an existing program t o improve user experience. Follow an iterative process to develop a solution to a computin g problem. Overview Continuing with the Sound Recorder project, students will acqui re peer feedback and reflect on their initial solution. Then, students will pl an and create a feature‐rich, sound recorder project. Key Focus Collect and evaluate peer feedback Use an iterative design process Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 2 – Sound Machine For the student: Lesson 4 Sound Recorder Iteration
28. © education.makeblock.com 28 Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 5 – Chase Game CyberPi – Lesson 5 – Space Adv entures Content Standards Type Indicator Standard CSTA 2‐AP‐16 Incorporate existing code, media , and libraries into original p rograms, and give attribution. ISTE 2c Students demonstrate an understan ding of and respect for the ri ghts and obligations of using and sh aring intellectual property. K12 CS Framework Practice 4‐1 Identify complex, interdisciplinary, real‐world problems that c an be solved computationally. K12 CS Framework Practice 7‐3 Articulate ideas responsibly by observing intellectual property rights and giving appropriate attribution. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Video Game Discussion 15 minutes Hands‐on Explore Example Games Abstraction and Decomposition 20 minutes Try It Pair Programming Modify an Example Project 5 minutes Wrap‐up Respecting Intellectual Property Lesson Extension(s) Activities
1. © education.makeblock.com 1 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Identify key features of the CyberPi. Connect a CyberPi to a comput er using mBlock software. Examine example programs for the CyberPi using the mBlock softw are. Overview Meet the CyberPi, a feature‐rich micro‐controller with a pletho ra of sensors, buttons and a full‐color screen display. Discover a variety of key features of CyberPi through an exploration of sample programs in mBlock. Key Focus Components and features of the CyberPi Navigate mBlock software Establish a connection between the software and hardware Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s) incl uded in mBlock software For the student: Lesson 1 Meet the CyberPi
25. © education.makeblock.com 25 Collect Peer Feedback 6. With the entire class, conduct a formal peer review and feedbac k activity. Explain how software developers rely on user feedback, reviews and data to plan for additional iterations of a computing solution. 7. Have students place their plan f or Sound Recorder 2.0 on their desk, open the program in mBlock and place the CyberPi with the uploaded recorder on their desk. 8. As time permits, have students r otate around the room and provi de feedback on their classmates projects. Some guiding questions for feedback may include: a. What feature do you like best about their project? b. Were instructions clear on how to use their recorder? Did you h ave to guess or make any assumptions on how to use it? c. Is there anything they could add to their project to make it mo re user‐friendly? d. Is there a feature you think wou ld enhance their recorder proje ct? Try It [20 minutes] Plan and Create Sound Recorder 3.0 1. Have students review the feedback they received and to brainsto rm a list of ideas for Sound Recorder 3.0 . Some ideas for improvements: o Include a title that appears when the CyberPi starts. o Change the colors of the on‐screen text. o Set a specific duration for the recording instead of using a st op button. o Use the joystick to control the volume and/or playback speed. o Display the current volume level on the screen or use the LED s trip to indicate the volume. o Have the LED strip animate while recording. o Use the joystick to control the duration of the recording by st oring the recording duration in a variable. 2. Following the steps from the pre vious lesson, have students ide ntify improvements, write pseudocode and create their Sound Recorder 3.0 project. Wrap‐Up [10 minutes]
52. © education.makeblock.com 52 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Use wireless network technology to communicate between computin g devices. Solve a problem using a computational solution. Identify uses for wireless communication. Overview Students will use the CyberPi to create a program which detects whether or not a friend has shaken their birthday present. Through the use of wire less communication, students wi ll send messages between computing devices, allowing one device to control another. Key Focus Using wireless networks Communicating between devices Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version Two (2) CyberPi’s with USB‐C cable or One (1) CyberPi and One (1) Halocode Pocket Shield (optional) Example program(s): CyberPi – Lesson 9 – Gift Alarm For the student: Lesson 9 Gift Alarm
46. © education.makeblock.com 46 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Write a program in mBlock that keeps score. Write a program that executes actions for a specified amount of time. Display text on the Cyberpi display. Overview In this lesson, students will create a fun game with the CyberP i where the player shakes the CyberPi for ten seconds. The students will progr am the game to keep score of ho w many times the shaking strength is greater than 50. Key Focus Keeping score Using the CyberPi Timer Displaying text on the CyberPi display Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 8 – Strength Meter For the student: Lesson 8 Strength Meter
39. © education.makeblock.com 39 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Use a variable to store a value. Change a variable based on user input. Write a program in mBlock that executes a program if a conditio n is met. Overview Students will be introduced to va riables to create a CyberPi Co lor Mixer. This program wi ll use the joystick and buttons to control the R, G, B c olor values of all of the on‐bo ard LEDs. Then, students will use conditional statements to ensure that the R, G, B values do not go out‐of‐r ange. Key Focus Storing data with variables Using conditional statements Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 7 – Color Mixer For the student: Computer with mBlock 5 installed or mBlock Web version Lesson 7 Color Mixer
8. © education.makeblock.com 8 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Identify CyberPi’s input(s) and output(s). Write pseudocode to plan and d esign a program in mBlock. Create a program in mBlock using the CyberPi buttons to trigger events. Select and use programming blocks to control the speaker and LE D strip. Overview In this lesson, students create a disco party using the on‐boar d LEDs and speaker. This program will use the CyberPi buttons to trigger events and run scripts. Students will also p rogram a button to stop al l sounds and lights, as well as a button to restart the CyberPi. Key Focus Input and Output components on the CyberPi Writing Psuedocode Creating a program in mBlock Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 2 – Sound Machine For the student: Lesson 2 Sound Machine
18. © education.makeblock.com 18 Warm‐Up [10 minutes] Evolving Computing Solutions 6. Discuss with students how comput ing solves everyday, real‐world problems. As a class, compile a list of computing solutions that student s and their fam ilies come acros s on a daily basis. Some examples may include: a. Smartphone b. Alarm Clock c. Refrigerator Alarm d. Automobiles e. Public Transit f. GPS g. Microwave h. Weather Report or App 7. Discuss with students how comput ing solutions have evolved over time. Here is a specific example you may want to share: Evolution of Direction s to a Destination o Using a printed road map or tran sit map to determine a route fr om one place to another prior to departure. o Using a website on a computer to generate printable directions prior to departure. (i.e. Mapques t or a transit website) o Using a mobile device to view a website with dir ections while i n route. o Using a mobile device to view a map while in route (no directio ns provided). (Note, this was the first iterat ion of the Google Maps app; it had no directions.) o Using a mobile device to view a map with driving directions or transit directions. o Using a mobile device to provide turn‐by‐turn GPS driving direc tions (no transit or walking support, yet). o Using a mobile device to provide turn‐by‐turn GPS driving direc tions with route adjustments based on live traffic data. o Using a mobile device to provide GPS‐assisted dr iving, walking, or transit directions in real‐time. The use of GPS directions on a s martphone or mobile device has evolved over time. For example, the first iteration of Google Maps was missing many ke y features (i.e., walking directions, public transit, live traffic, road closures, destin ation information, etc.) which have been added over time through evaluation of the solution, u ser feedback and data collection. Hands‐On [10 minutes] Make a Plan
27. © education.makeblock.com 27 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Differentiate between stage progr amming 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. Overview In this lesson, students will turn the CyberPi into a game cont roller by combining devic e programming and stage programming in mBlock. Students will examine example programs t o 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. Key Focus Combine stage programming and device programming Pair Programming Decomposition and abstraction Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 5 – Chase Game CyberPi – Lesson 5 – Space Adv entures For the student: Lesson 5 Game Controller
33. © education.makeblock.com 33 Subject: Computer Science Grade(s): 6‐12 Duration: 45 Minutes Difficulty: Beginner Objectives By the end of this lesson, s tudents will be able to: Describe how CyberPi s ensors detect the surrounding environment . Debug errors in programs in mBlock. Document a program using comments in mBlock. Overview Discover how the on‐board sensors on the CyberPi represent loud ness and light intensi ty of the surrounding environment. Students will learn about data representation and graphing of sensors values. Key Focus Data representation Debugging programs Understanding sensors Pre‐lesson Checklist For the teacher: Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s): CyberPi – Lesson 6 – Sensor Meter CyberPi – Lesson 6 – Sensor Meter V2 For the student: Computer with mBlock 5 installed or mBlock Web version Lesson 6 Sensor Meter
41. © education.makeblock.com 41 Activities Warm‐Up [5 minutes] Conditional Statements Game 28. Play a game similar to Simon Says with your class to demonstrat e conditional statements. With your students, read each statement below and have the students obey the command. (Feel free to write your own commands for your students.) o IF your name has the letter “S” in it, THEN raise your hand. o IF you have a pet cat, THEN clap your hands. o IF you play a sport, THEN stomp your feet. o IF you are wearing socks, THEN touch your feet. o IF your favorite ice cream is chocolate, THEN say “Yum.” 29. Share with students that these commands are examples of conditi onal statements. In programming, conditional statements are used t o perform specific actions if a condition is true. Hands‐On [15 minutes] Storing Data with a Variable 9. Discuss the following defi nition with the students: Term Definition* variable A placeholder for a piece of information that can change. *Definitions from Co de.org – CSD Unit 1 10. Review the following challenge and pseudocode with the students : Color Mixer Project Description Create a project where the joyst ick and buttons on the CyberPi control the R, G, B values of all of the LEDs. Pseudocode When the joystick is pulled up: Increase the red (R) value of all LEDs by 5
2. © education.makeblock.com 2 Computer with mBlock 5 installed or mBlock Web version CyberPi with USB‐C cable Pocket Shield (optional) Example program(s) incl uded in mBlock software Content Standards Type Indicator Standard ISTE 6a Students choose the appropriate p latforms and tools for meeting the desired objectives of their creation of communication. K12 CS Framework Practice 2‐1 Cultivate working relationships with individuals possessing div erse perspectives, sills, and personalities. Agenda (45 minutes) Duration Content 5 minutes Warm‐up Meet the CyberPi 15 minutes Hands‐on Tour of mBlock 5 Connect the CyberPi o Add the CyberPi Extension o Test Live Mode Explore an Example Program o Test Upload Mode 20 minutes Try It Explore Example Programs 5 minutes Wrap‐up Reflect on the CyberPi Features and Capabilities Brainstorm Ideas for CyberPi Programs Lesson Extension(s)
4. © education.makeblock.com 4 Name of Area Function Menu Bar Select language Create, open or save the file Find an example program, help file, etc. Stage Area View the project stage Select and edit sprites and backgrounds Connect hardware devices Block Area Find and select script blocks organized into color‐coded categories Find and add extensions Script Area Combine blocks to create programs or scripts Drag blocks and arrange them in a certain order to control sprites, backgrounds and/or devices Connect the CyberPi 3. Plug the CyberPi into the comput er using the included cable. The CyberPi should boot up and th e screen will display either the last program upload ed 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 successfu lly, the button will change to Disconnect .
6. © education.makeblock.com 6 CyberPi can be disconnected from the computer mBlock software may be closed Program will remain on CyberP i until a new program is uploaded in its place 17. Switch the CyberPi to Upload mode and click the Upload button. 18. The Upload Progress window will appear and will dis appear when uploa ding is comple te. The CyberPi will reboot and observe the Rainbow Lights program. Every time the CyberPi starts up, the Rainbow Lights program will run. Try It [20 minutes] Explore Example Programs 1. Instruct students to explore 3 of the remainder of the example programs included with mBlock. Some suggestions include: o Buzzer o Twinkle Twinkle Little Star o Voice Reactive Lights o Trigger Reminder o Simple Timer o Step Counter o Motion‐sensing Chart 2. While they review the projects, have them document the followin g for each program they explore: o Write a description of the program. o Identify which components of the CyberPi are used for each task of the program. o Make inferences about what porti ons of the project code does. Wrap‐Up [5 minutes] Reflection & Brainstorming
5. © education.makeblock.com 5 Not Connected Connected 7. Notice, the CyberPi is connected in Live mode. Let’s test the connection. 8. In the Block Area , choose the LED category. 9. Click the block. Observe the Cyb erPi as the LED strip displays the colors indicated. Explore Example Programs 10. Click Tutorials in the upper right corner. Select Example Programs . 11. Choose the CyberPi label to see example programs for the CyberPi. 12. Find and select the Rainbow Lights program. 13. Have students read the code an d predict what will happen. 14. Connect the CyberPi in Live mode. 15. Click the block. Observe the Cyb erPi as the LED strip displays the colors indicated. (Note, a glowing yello w border surrounds the script in the Script area indicating the script is running.) Click the block s to stop the program. 16. Explain to students the difference between Live mode and Upload mode. Mode Description Live Mode Program is run by the computer (is not stored on the CyberPi) CyberPi must remain connected to the computer mBlock project must remain open Must be used for stage programming Upload Mode Program is uploaded and stored on the CyberPi No communication w ith the computer