Table of Contents

Function Definition: playsounduntildone(audio = "QuarkyIntro")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
audiointThe name of the audio file need to be played."QuarkyIntro", "turningLeft", "turningRight", "goStraight", "UTurnDetected", "oneDetected", "twoDetected", "threeDetected", "fourDetected", "fiveDetected", or "QuarkyBootUp""QuarkyIntro"

Description

The function plays the specified audio on the Quarky speaker. The function has a callback, so other functions will be executed after the audio is played.

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