В момента ресурсът е наличен само на английски

Dot operator and importing commands Pro Preview

Have you noticed how the "start_at_power()" command is written after the "MotorPair()" command and they are separated by a dot? This dot separation is called a "Dot" operator.

Необходимо е да се абонирате за FLLCasts.com, за да достъпите това видео

Абонирай се

  • #1659
  • 20 Aug 2020

The dot tells the robot that the "start_at_power()" command is a property of the "MotorPair()" object. "MotorPair()" holds information regarding which motor must be activated by the "start_at_power()" command and without this information, the "start_at_power()" command cannot be executed.

In order to use these commands, we need to add the following line of code at the beginning of our program:


from spike import MotorPair


With it, we import the "MotorPair" object. Notice that the "start_at_power()" command is not imported, because it comes imported with the "Motor" object as its property.