Back to scenarios
Grades 6-8
7, 8
Grades 9+
9, 10, 11, 12

Mateusz Chmielewski

Programming the Photon Robot in Python #1 Getting to know Photon and Python!

Duration time:
45 min.
Programming interface:
Photon BlocksPython (Photon Magic Bridge)
Back to scenarios
Scenario Image

Class goal:

  • to learn the basics of the Python programming language syntax and how to use it with the Photon Robot
  • to understand how the Photon Robot works and its main features
  • to prepare a simple programming code in Python (using motion and sound)

Teaching methods:

  • experimenting
  • group tasks
  • discussion

Type of exercise:

  • group

Required items:

  • One PC per team
  • Computers/smartphones with Internet access (to watch videos)

Lesson scenario:

1. Introduce students to the subject of robotics

2. Principles of working with a robot

  • Provide each group with a robot. But first, explain the rules that apply to all Photon Robot classes. If you already have them, explain the rules or invite students to create a list together.

3. Testing the robot’s capabilities

  • Launch the Photon Magic Bridge application and connect the robot to the computer.
  • Test the robot using the Photon Blocks interface. Let students freely explore its functions and experiment for 10 minutes. Make sure that everyone in the group has a chance to test the robot.

4. Programming in Python - an introduction

  • Move on to programming in Python. Ask students: In your opinion, why do we learn more complex ways of programming if we can easily program the robot in Scratch, or another simple visual language?
  • Point out that simplifications limit our possibilities, while “mature” programming languages are more versatile and are used more often in real life
  • Explain the setup of the programming environment.
  • Individual commands, same as separate blocks in Scratch, are called “Methods” in Python.
  • Show students where to look for available Photon Robot methods - to open a list of all “methods” specific to the Photon Robot programming, please click on the question mark icon in the top bar menu (see the screen below).
  • explain the ones shown on top of the import project *

Python is a very popular programming language but with many extensions and add-ons. It is like speaking in English, we use it every day, but we don’t know all the words – sometimes we have to Google them up or check in a dictionary. Programming is the same. It’s a bit like someone telling you at the beginning of a conversation that there will be a lot of specific medical terminology. To understand this person, you need to use a dictionary! Because the startup environment remembers only the basic Python methods and additions that we might need, it runs faster. In this project, we will use all (*) methods from the “photonrobot” library.

  • Pay attention to the comments. Please ignore parts of the code starting with the “#” - these are internal comments for developers reading the code.

List (Python methods for the Photon Robot) in the Photon Magic Bridge app

5. The First Program

  • Select and assign each group a specific destination (target) point. The programmed robot must reach the target and, once there, play a sound. Students must use the correct algorithm composed of several methods and test it.

6. Summary

Summarize this lesson and allocate some time to answer questions - most likely, students will get to know answers to their questions in one of the next classes.


The co-author of this lesson scenario: Michał Nowak.

Interesting facts / Questions time

  • Most often, robotic arms (manipulators) are used in the automotive industry, during medical procedures, in laboratory research, space, and ocean floor explorations.
  • Where else could we use robots?

Discussion (No comments)

Log in to start a discussion