Start Here!

Introduction To MicroPython and Spike Robots

Get ready for an exciting journey into the world of Python programming for your LEGO Spike robot! In this series of beginner-friendly training modules, you’ll learn how to make your robot move and tackle various missions. Don’t worry if you don’t have a physical robot yet – we’ve got you covered with a virtual robot and a simulator that mimics the real Lego Spike experience.

For this level, we’ll be using “Pybricks Micropython” to program a virtual “Spike Robot” using a “Simulator”. Let’s review what each of these terms means.

Pybricks Micropython

MicroPython is like a language that helps you talk to your real or virtual LEGO Spike robot. You can use it to give your robot cool instructions, like telling it to move around or do tricks. It’s like using a special language to talk to your robot so you can tell it what you want it to do. So, with MicroPython, you get to be the boss and make your robot do all kinds of fun stuff!

More technically, the Micropython language is a software implementation of the Python programming language that is designed to run on microcontrollers and small embedded systems. It brings the ease and simplicity of Python to hardware platforms with limited resources, making it well-suited for devices like microcontrollers, single-board computers, and other small computing devices. Pybricks is a programming library specifically designed for use with LEGO Spike, a robotics platform created by LEGO for educational purposes. Pybricks allows users to program the LEGO Spike brick, motors, sensors, and other components using the Python programming language.

Spike Robot

The Spike robot is something you specially design to solve exciting challenges. Picture it with wheels, sensors, and all sorts of cool features—ready to tackle the missions and tasks in the competition arena.

The Spike robot can be equipped with sensors that act as its eyes and ears, helping it navigate the competition field and interact with the elements around it. But here’s where it gets even more awesome: you get to be the commander! Using a special computer called the “brick,” (or sometimes called the “brain”) you’ll give your robot precise instructions to complete specific missions all by itself. It’s like coaching a robot teammate to score points, solve problems, and showcase the special abilities you have given it in the competition.

Example Real World Spike Robot:

Example Virtual Spike Robot:

Simulator

A Simulator is virtual world for your Spike robot! It is a special computer program that lets you test and practice your robot’s moves without needing the actual physical robot. It helps you learn and experiment with programming—creating the special instructions that tell your robot what to do. It’s like having a practice field for your robot where you can make mistakes, learn, and perfect your coding skills.

Bolton Robotics uses a version of the simulator created and maintained in the github repository https://github.com/QuirkyCort/gears Many thanks to all the developers for providing this free simulator for all to use!

Example Spike Virtual World Simulator

Before you jump into the more advanced training, make sure to complete each of the introductory modules. These modules are designed to introduce Pybricks Micropython using a virtual Spike robot in a simulator. They’ll lay the foundation for your coding skills and prepare you for the challenges that lie ahead in the intermediate level training. Happy coding!

Training Modules


Launch Lesson 1
Create Your First Python Program.
Using the simulator write a python script to move virtual blocks into scoring areas

Launch Lesson 2
Changing Speed Using the Drivebase Settings
Use the drivebase settings to change the speed of your robot

Launch Lesson 3
Debugging
How to debug your python program

Launch Lesson 4
Code Loops
Learn how to use a code loop to perform a repeated action

Launch Lesson 5
Driving using code loops
Using loops to drive on a curve and line follow

Launch Lesson 6
Squaring up on mission models
Learn about how and why to square up on a mission model

Launch Lesson 7
Wall Following
Learn about how and why to wall follow

Challenge Modules


Launch Challenge #1
Navigate a virtual obstacle course
Looking for something significantly more challenging? Put your skills to the test and create a python program to complete the virtual obstacle course.

```