Back to: Fusion Robot Fun – Converting from blockly to Python.
In the video below we combine the Edge-Follow and SUMO Blockly Functions into a program that will teach our Fusion Robot to follow the curving path through our pretend wilderness, cross the pretend silver sand beach, and clear left-behind toys from our pretend swimming pool by pushing them to the edge of the pool so they can be collected by our non-swimming teacher.
We then convert this Blockly code into Python Code. We examine the Python code, line by line. We then see if this code works when it is run on our Fusion Robot.
Fortunately, this code works beautifully with our Fusion Robot!
This Challenge also illustrates the use of “functions”. Functions are tremendously useful in coding. They can encapsulate past coding wisdom in easily re-usable packages. These “packages” (called functions, procedures and other names in different coding languages) can be assembled into libraries, for future re-use. Sometimes these “libraries”, can be private, containing secret expertise that a company sells. Sometimes programmers release their code for free use by other programmers – just like our videos that we release for free use by students world-wide. If you are learning Python, it is REALLY worthwhile learning how to use functions. We will have more about functions in later tutorials.