The new EV3 MicroPython framework allows for usage of the highly versatile Python programming language to control EV3 bricks, using a special version of Linux as an operating system. In this lesson, we will learn basic Python principles as well as general programming dogmas.
We begin with thinking about how we can tell robots what to do, from an abstract point of view. Watch the videos below (credit to Carnegie Mellon CS STEM curriculum):
Programming requires a different way of thinking, specifically in the following terms:
- Input (from sensors or a human)
- Output (actions of the robot, lights, sounds)
- Conditional Execution (Doing things only if something is the case, or something special happens)
- Repetition (Doing things over and over until something happens, or for a number of times)
In Python, we can do all of these. Python programs look like text files, and each line contains a command for the computer/robot.
We can begin with telling the computer to print ‘Hello, World!’ (as is the custom of first programs):
Here, the command
Similarly, we will learn to tell the robot to do things using other commands more complicated and powerful than
That’s it for this lesson ! Thank you. © The RoboMentors