Table of Contents

video()

Function Definition: video(video_state = "on", transparency = 1)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
video_statestringSet the state of the camera feed on the stage to the specified state."on", "off", or "on flipped""on"
transparencyintSet the transparency of the video on the stage.0-1001

Description

This function helps turn the video on/off on the stage with a defined level of transparency.

  • On, the default option turns the video on, off switches it off, and on flipped turns on the camera feed, but flipped.
  • The transparency percentage can be set by entering a numeric value as an argument.

Example

The example demonstrates how to make a delivery robot that follows the line and stops when it reaches checkpoint 1 in the Python Coding Mode.

Code

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

cards.video("on", 0)
cards.enablebox()
cards.setthreshold(0.5)

quarky.setirthreshold("IRL", 3000)
quarky.setirthreshold("IRR", 3000)
quarky.initializelinefollower(35, 40, 10)

quarky.drawpattern("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

while True:
  if not (quarky.getirstate(35) and quarky.getirstate(34)):
    quarky.dolinefollowing()

  else:
    quarky.stoprobot()
    cards.analysecamera()

    if cards.isnumberdetected(1):
      quarky.drawpattern("ccccccccccccccccccccccccccccccccccc")
      break

    quarky.runrobot("FORWARD", 40)

Output

Read More
All articles loaded
No more articles to load