Table of Contents

Function Definition: setorientation(orientation = "HORIZONTAL")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
orientationstringThe robot orientation."HORIZONTAL" or "VERTICAL""HORIZONTAL"

Description

The function sets the orientation of the robot to align the left and right movement of the robot in horizontal robot position and vertical robot position.

Example

The example demonstrates how to make a vertical robot pet that senses the hand on the IR sensor and acts accordingly in the Python Coding Environment.

Code

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

quarky.setorientation(2)
quarky.setirthreshold("IRL", 3000)
quarky.setirthreshold("IRR", 3000)

while True:
  if quarky.getirstate("IRL"):
    if quarky.getirstate("IRR"):
      quarky.cleardisplay()

    else:
      pass
      quarky.runrobot("LEFT", 100)
      time.sleep(0.3)
      quarky.stoprobot()

  else:
    pass
    if quarky.getirstate("IRR"):
      quarky.runrobot("RIGHT", 100)
      time.sleep(0.3)
      quarky.stoprobot()

    else:
      pass
      quarky.showemotion("happy")
      quarky.playsounduntildone("QuarkyIntro")

Output

Read More
All articles loaded
No more articles to load