1. Lesson 1 - Larva robot


content picture

In this lesson you are going to make Larvy, the SPIKE larva robot. It is called that, because it moves like a larva or a caterpillar! Its program is very simple as its core consists of only 3 movement blocks in a loop. We, however, have complicated it a little so that it runs more smoothly and consistantly! You can read more about the program in its description.

But first, lets build the robot!!!

Larvy - LEGO SPIKE Prime larva robot

Larvy is a SPIKE Prime robot, that moves like a larva or caterpillar. The robot has a Large motor, that contracts and expands it! Using the two medium motors, it turns 4 tyres to their side and upright whenever it wants, so that it can move forward!

A program for the robot can be found here: Program for Larvy - LEGO SPIKE Prime robot

Before you download the program, make sure you have the SPIKE programming software.

To get the software, download the appropriate installer for your Operating System from here: https://education.lego.com/en-us/downloads/spike-prime/software

From there just start it and it will install all you need.

To open the program we have given you below, after you download it, just double click it and it should open with the SPIKE Prime software you just installed. Another option is, after you open the software, go to File→Open File and choose the downloaded file.

Program for Larvy - LEGO SPIKE Prime robot

This program makes Larvy - LEGO SPIKE Prime larva robot move forward indefinitely! The movement of this robot is very interesting as it works like a caterpillar or larvae! The program works by repeating 3 movements every cycle of the loop:

  1. the front motor rotates for 90 degrees, rising or collapsing its wheels
  2. the large motor rotates for 90 degrees, contracting or expanding the robot
  3. the back motor rotates for 90 degrees, rising or collapsing its wheels

You may notice that every movement command does two things, or the same thing but a different direction. That is done using a variable that is either 1 or -1, and that gives the direction that the motors should move. This variable is also used to determine which motor should use full power and which shouldn't so that the robot doesn't break itself!

How to connect your computer to your SPIKE Prime hub?

After you download the SPIKE programming software, to load a program to your robot, you need to connect to your hub! Now lets learn how you can do that! 

There are two options to connect your computer to your hub, through cable or bluetooth.

To connect through cable, all you need to do is plug in the cable to your computer and hub, and they should be connected! This is also the way you charge the hub's battery.

Usually it is preferred to connect through bluetooth, because you can move your robot basically anywhere in a room! That means if you want to see the sensor readings or what a variable's value is, while the robot is moving, it is way easier to connect through bluetooth. In the video we have shown you how to do it. The main things you need to do are:

  1. Turn on the hub, that is done by pressing and holding the middle button for 1-2 seconds
  2. Turn on bluetooth, that is done by just pressing the bluetooth button
  3. Find your brick and connect to it, that is done in the app and is shown in the video how to get there