What is Multi-threading Pro Preview

So far we have created programs that execute actions one after another. But sometimes we need to perform two actions at the same time. How do we achieve that?

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1170
  • 22 Mar 2019

The setup

For example, if we want to program our robot to move along a given field and meanwhile it needs to move a hand with another motor(s). To be more precise let us say that we want our robot to move along a square and move a medium motor 240 degrees forward, then 240 degrees backward. 

The problem

Each of the above tasks is relatively easy. The following program will make the robot to move in a square:

and the following program will make its hand move back and forth as described:

The problem arises when we want to perform the above two programs simultaneously.

The solution

In such cases, we need multiple threads. When computers have some actions to be performed they order them in threads. Each thread is executed by executing each of the tasks within one by one. If you need to perform two groups of actions simultaneously, you just need a new thread, so that each group will run in its own thread. 

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Instructors Remote Training
  • 136
  • 280:11
  • 156
Image for Threads and Multi-threading
  • 5
  • 1
  • 9
  • 3d_rotation 1