How to use the
Learning Portal

Learning Portal

Our hands-on, comprehensive lesson plans span a range of levels. Browse our free STEM and coding learning resources.

Marty Image

2.14: Marty's Disco Arms React to a User

90 Minutes

Lesson Overview

In this lesson learners will extend their understanding of conditional statements (if statements) to practice with a nested statement. Learners will use the Marty disco arms to secretly store an angle measurement. Then, learners interacting with Marty will use problem solving skills, specifically estimation, to narrow down the secret value. The disco arms will give clues as to whether the position of the arm is too high, too low or just about right.

Please read the knowledge base article about the Disco addons, if you haven't already.

Key vocabulary:
    estimate, conditional / if statement, range,

Content Sections

  • Learning Objectives
  • Warm up
      • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
      • Get Learning
      • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
        Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
      • Time for Practice
        • Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
          Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
        • Cool Down
          • Extensions & Challenges
          • Extend
            • Alternate Extension
              • Support
              • Additional Reading
              • 2.14: Marty's Disco Arms React to a User

                90 Minutes

                Lesson Overview

                In this lesson learners will extend their understanding of conditional statements (if statements) to practice with a nested statement. Learners will use the Marty disco arms to secretly store an angle measurement. Then, learners interacting with Marty will use problem solving skills, specifically estimation, to narrow down the secret value. The disco arms will give clues as to whether the position of the arm is too high, too low or just about right.

                Please read the knowledge base article about the Disco addons, if you haven't already.

                Key vocabulary:
                  estimate, conditional / if statement, range,
                • Knowledge of angles and estimation, conditional statements (if/then), nested conditional statements; knowledge of inequality symbols <, >; experience with sensing blocks
                • Tablet with Bluetooth 4.2+
                • Angles up to 180 degrees and estimation
                  • Marty the Robot V2
                  • Marty Workbook
                  • Tablets
                  • Access to the MartyBlocks editor
                  • Disco Arms add on for Marty v2
                  • Protractor (optional)

                Learning Objectives

                • I can use conditionals to create a target angle range, in degrees.
                • I can improve on previous designs.

                Warm up

                Have various small objects hidden in the classroom. Ask for volunteers to attempt to find them using words like, getting warmer, getting colder, and others, to guide the searcher. Repeat the game, with covered numbers between 0 and 100 on the board. Give clues like, higher, lower and adverbs to state the degree of how close they are: a little bit higher, much lower, etc. Reveal the number when it was guessed. Below is an example game:

                • The 'secret number is 39.
                • A learner guesses 5, you reply, much higher.
                • A learner guess 80, you reply, much lower.
                • A learner guesses 50, you reply, lower.
                • A learner guesses 40, you reply, a tiny bit lower.
                • A learner guess 35, you reply, a tiny, tiny bit higher.
                • A learner guesses 37, you reply, exactly, or words to that effect.

                Discuss the process of giving clues: when the estimate was far from 37, much higher / lower was used. As the estimates became closer to 37, different words were used to describe what to do next. Show a number line on the board. Mark 0 and 100 at opposite ends. Mark 37 to the left of centre. Mark the estimates as they go. Highlight the 'tiny bit higher / lower guesses. How far were they from 37? Suggest that this is an inequality: when the guess is less than 37 and more than 32 (or something nearby), you might say 'a tiny bit higher'; when the guess is more than 37 and less then 42 (or something nearby), you might say 'a tiny bit lower.

                Visual clues can be used to guide a person to the correct answer. Today, we will be using lights to guide a user to choose a mystery number.

                Display the first three slides of the ppt, the title, objectives and success criteria.

                Display an example of Marty responding to code, where his arm moves and the colour on the disco arm changes depdending on how close or far away the secret angle value is. The example will be explained in the teacher's guide.

                For the code, you will find the following blocks in the following sections:

                • the position block in Sensing,
                • the set LEDs blocks in Looks,
                • the green inequality blocks in Operators
                • the forever loop and if blocks in Control

                The set eyes LEDs should have arms selected and is there to reset the lights after running the code.

                The blocks are also part of the recommended blocks for learners to use.

                Have learners estimate the value of Marty's secret angle after watching the display. Inform them that when Marty's arms are pointing down, it is 0 degrees and when the arms move to point straight up it is 180 degrees. The lights change when the angle of the arm is close to the secret value.

                Get Learning

                At this point, everyone should have MartyBlocks loaded, with Marty connected. Display the slide called 'The Disco blocks', from the presentation. They will notice that each of the three blocks has 'arm' showing and an arrow pointing down. Quickly revise that these are the same three blocks we used for the lesson on the disco eyes, on this occasion we select the arms from the dropdown.

                Have learners drag the three blocks onto the workspace and explore them. Show learners the next slide, a very basic block of code displaying all three of the blocks in action.

                Learners will notice, again, that the script happens amazingly quickly. It doesn't change once it runs once and there are no conditions: on start, all the blocks run and they only run once. How do we have the code run more than once? A repeat block. How do we set a condition in the code? An if block.

                For the task today, we need a fourth block, which is a sensing block. This block will tell us the position of the arm, or arms. Show the block for sensing the arm position and where it can be found, in the sensing section. The image shows 'right arm' selected. Either right or left arm is OK for this code. They are accessed with the drop-down menu.

                When learners drag this block onto the workspace, have them tap it and share what it displays. Have them move the arm forward and up (no more than pointing straight upward) and tap the block again. Has the value changed? To what did it change? Why do you think this?

                Display the slide showing a protractor overlaying Marty, subsequent slides show different arm movements with the value of the angle highlighted.

                Time for Practice

                Learners will be tasked with creating an estimation game:

                • they need to think of a number for Marty that users try to estimate
                • they need to tell Marty the range for that number to help with estimation
                • they need to be told when the angle is too high or too low
                  • blue, or different shades of blue, can be used to symbolize cold, or too low;
                  • red can be for too high;
                  • a pattern, or sequence, of lights can be used to indicate that the learner is close.

                Have learners use their workbooks to see how they can write some if statements to inform the code they will create in MartyBlocks. The workbooks suggest using pseudocode to describe the if statements as we would speak them. Remind learners that the 'guess' will be the position of the arm. But the person moving the arm will still need to say an estimate for that angle. There are blanks for the secret number that can be used and blanks for the guesses and statements to give as feedback.

                For planning the code, the following blocks are recommended:

                Once coding is complete, organize groups so that they can determine other secret angle values. There will need to be one individual from each group staying with their Marty to manage the estimation work; this person should change with each new group. A countdown tune could be playing on the class computer to give groups a time limit for the estimation. Before beginning the practice, emphasize that Marty is delicate and should not be forced strongly - the arms must be turned in a controlled and responsible way. This might take between 5 or 10 minutes to carry out.

                Countdown music 1

                Countdown music 2

                Cool Down

                Bring learners back together to discuss the challenges they faced and overcame. Have groups model their creations and explain what is happening, when. Encourage questions about differences between the design of different groups' code. If a group chose to explore any extension activities, allow for time to explain this.

                Suggested questions you might ask:

                • How did you choose the range for the different colors and patterns?
                • How did you make sure the secret angle value stayed secret?
                • Did anyone think about how to code for both arms?
                • Did anyone think of a way to have users type in their estimate so that Marty moves the arm?

                Carry out any end of lesson routines.

                Log off devices and clear everything away.

                Extensions & Support

                Extend

                Challenge learners to create different ranges depending on how closer a user is to the secret angle value. Learners will:

                • need multiple conditonal statements.
                • need to decide on an appropriate scale to feedback to users.
                • need to be able to explain what they have done.

                Alternate Extension

                Challenge learners to use their knowledge of parallel programming to code Marty to lift both arms at the same time. Learners will:

                • need to apply parallel programming to make the arms move at the same time as the light alerts the user to the secret angle.
                • need to decide on the timing of the arm movement.
                • need to decide on the increments for each movement burst.

                Support

                Have profile photos of Marty with a range of arm movements - in 30 degree increments, for example - to support estimation of degrees for the secret value.

                Provide a number line with symbols for > < to be placed on it, to help learners visualise the range of values that should tell users they are close to the secret value.

                • Middle School Technology Applications: Grade 6 to Grade 8
                • Technologies: Computing Science
                • Literacy & English: Listening and Talking
                • Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
                • Numeracy: Number, Money and Measure
                • Literacy & English: Writing
                • Computing, Design and Technology: Design and Technology
                • Computing, Design and Technology: Computing
                • CSTA Education Standards
                • Digital Technologies, Design & technologies: Digital Technologies
                • International Society for Technology in Education (ISTE)