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

Trial Lesson Upper Elementary 45 minutes - the Color Controller

45 Minutes

Lesson Overview

In this lesson learners will create code that will mimic screen free mode, for Marty.

In order to work with this lesson, Marty will need to have a color sensor installed, which comes as standard. Details about the color sensor can be found by clicking on this link.

Key vocabulary:
    sensor, if statement, conditional statement, repeat block, stop all,

Content Sections

  • Learning Objectives
  • Warm up
  • Get Learning
  • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
        Unknown block type "embedHTML", please specify a serializer for it in the `serializers.types` prop
        Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
      • Time for Practice
      • Cool Down
        • Extensions & Challenges
        • Extend
          • Support
            • Additional Reading
            • Trial Lesson Upper Elementary 45 minutes - the Color Controller

              45 Minutes

              Lesson Overview

              In this lesson learners will create code that will mimic screen free mode, for Marty.

              In order to work with this lesson, Marty will need to have a color sensor installed, which comes as standard. Details about the color sensor can be found by clicking on this link.

              Key vocabulary:
                sensor, if statement, conditional statement, repeat block, stop all,
              • Awareness of if statements and repeat blocks
              • Tablet with Bluetooth 4.2+
              • Writing instructions, Maths estimation and direction language
                • Marty the Robot V2
                • Marty Workbook
                • Tablets
                • Access to the Marty Blocks editor
                • Color Sensor add on for Marty v2

              Learning Objectives

              • I can use multiple if statements to command Marty to act.
              • I can improve on earlier code to make the result more accurate.

              This is recommended as a floor activity as it will require a degree of movement, from Marty.

              Warm up

              Show learners how to start Marty in Unplugged mode. This will allow learners to instruct Marty without making use of the app at all. Click here to see how screen-free coding works.

              Have learners experiment with the color cards to see what Marty can 'recognize'. Ask learners to tell you the different commands that Marty performs as a response to the colors and make a record of this for learners to see for the duration of the lesson - this could be done on a board in the classroom or in the workbook for each group.

              Share with learners the objectives and success criteria for today's lesson, from the presentation file, (slides 2 and 3).

              Get Learning

              Share with learners the first video from the presentation (slide 4), showing a door sensor at work: opening when a person comes close enough. Take time to think and talk about what part of the door causes the door to move. Ask learners if they can think about any other examples where machines sense objects. Extend the thoughts about sensing machines to Marty (slide 5 shows Marty in action). Either show the slide from the presentation or model a Marty with the code that is available below, beside the video, and separately in the Teacher's guide. Do not display the code to the learners.

              Below is a video clip and code that mimics screen-free mode.

              Ask questions about how Marty might decide to move as they do:

              Below are so discussion ideas. What do we need in code to have an action occur when something else happens, first? Learners might suggest an if statement if they have previously engaged with Scratch. If learners do not offer this, ask questions like, when do you go home from school? Answers might include,

              • "When the bell rings at the end of the day," or, "when it is (fill in the time)."
              • Ask them back, "So, if the bell rings at the end of the day, then you go home?"

              Ask for other scenarios like this if you want to reinforce the need for 'if'.

              • When do you line up to come inside?
              • When do you tidy your desk?
              • When do we go to for PE?...

              Have learners think about how an if statement is composed - "If one thing happens, then another thing will result."

              Show the code block for the color sensor, in the presentation (slide 6), and show the result as Marty stands on different color cards. Show the structure of the if statement (slide 7) so learners can see what is needed for the if statement to be used effectively.

              Share an example of Marty reacting to a color and performing an action (slide 8). If modelling with your Marty, ensure that the robot is standing on the required color before running the program - Marty will not perform an action unless they are already standing on a color card when you press to run this code. Change colors, nothing will happen. Bring the initial color back. Nothing will happen. Question what it is that stops Marty from moving again. Have them think together with their groups and use their discussion to inform their work, rather than having answers shared with the whole group.

              Below is a starter video clip that shows one if statement with one color.

              Time for Practice

              Task learners to create code for one color, including that when the color is removed and returned, Marty will move again. A starter block of code, checking if the color green is detected, once, is on slide 9. Questions on slide 10 might be enough to encourage them to think about their code.

              Once learners have discovered the necessity of the repeat block, or other methods for repeating the movement, have them expand their code to consider other colors and the necessary action. How can we ensure that different movements will happen when colors change but still check for all of the colors? Learners will need to have multiple if statements inside the repeat forever block to accomplish this.

              While learners do not have access to a physical Marty, have them role play as a Marty with developers running the code and Martys reacting to the colors.

              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; this can be done with learners role playing as Marty or using their device, if they can connect to the class Marty. Encourage other groups to ask questions to deepen their understanding of the processes. There is space on slide 11 to record class findings.

              Suggested questions you might ask:

              • How did you account for multiple colors and different actions?
              • How did you make sure Marty performed the same action if he detected the same color again?
              • Did you think of a way to code a stop for the program?
              • Did anyone find any other colors that Marty knows?

              Carry out any end of lesson routines.

              Log off devices and clear everything away.

              Extensions & Support

              Extend

              Challenge learners to modify the responses to the color to something different than the Unplugged coding commands:

              • The colors could signal a dance routine.
                • There would still need to be some movement but they could all be 'walk forward' after completing the moves.

              Support

              Have physical code cards available for learners to use, when building their scripts:

              • if/then and if/then/else blocks
              • operator blocks: <, >, =
              • a variety of movement blocks

              Have a print out of the basic if statement for the green color.

              For learners who are challenged by estimation, encourage learners turn on Marty's Unplugged mode so that they can count the steps between the cards before assigning values to the movement blocks.

              Additional Reading

              Look at some of the lessons that use loops and conditional statements:

              Choices with an If Statements

              Using loops

              Additionally, please consult the instructions for installing the color sensor


              • Technologies: Computing Science
              • Literacy & English: Listening and Talking
              • Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
              • Literacy & English: Writing
              • Computing, Design and Technology: Design and Technology
              • Computing, Design and Technology: Computing
              • CSTA Education Standards
              • Elementary Technology Applications: Grade 3 to Grade 5
              • Digital Technologies, Design & technologies: Design & Technologies
              • Digital Technologies, Design & technologies: Digital Technologies
              • International Society for Technology in Education (ISTE)