Table of Contents

stopmotor()

Function Definition: stopmotor(motor = "L")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
motorstringThe motor which you want to control."L" or "R""L"

Description

The function stops the specified motor of the Quarky.

Example

Robot Forward
The example demonstrates how the robot moves forward, backward, left, and right using motor direction control in the Python Coding Environment.

Code

sprite = Sprite('Tobi')
quarky = Quarky()

# imported modules
import time

# User Defined Functions
def Forward():
  quarky.runmotor("L", "FORWARD", 100)
  quarky.runmotor("R", "FORWARD", 100)
  time.sleep(1)
  quarky.stopmotor("L")
  quarky.stopmotor("R")

def Backward():
  quarky.runmotor("L", "BACKWARD", 100)
  quarky.runmotor("R", "BACKWARD", 100)
  time.sleep(1)
  quarky.stopmotor("L")
  quarky.stopmotor("R")

def Left():
  quarky.runmotor("L", "BACKWARD", 100)
  quarky.runmotor("R", "FORWARD", 100)
  time.sleep(1)
  quarky.stopmotor("L")
  quarky.stopmotor("R")

def Right():
  quarky.runmotor("L", "FORWARD", 100)
  quarky.runmotor("R", "BACKWARD", 100)
  time.sleep(1)
  quarky.stopmotor("L")
  quarky.stopmotor("R")

Forward()
Backward()
Left()
Right()

Output

Robot Forward

Robot BackwardLeft RobotRight Robot

Read More
All articles loaded
No more articles to load