Misty Lessons
  • Misty Lessons
    • 📖Welcome to Misty Lessons
    • 📚Get to know your Misty
    • 📲Connect to Misty
    • 👩‍💻Misty Studio
    • 🖥️Desktop Environment
    • ⬆️Update your Misty
    • 👥Projects
  • Blockly
    • 🧩Blockly Lessons
      • 🤸Lesson 1: Movement
      • 🎶Lesson 2: Voice and Sound
      • 🎭Lesson 3: Expressions
      • 🎥Lesson 4: Robot Cinema
      • 🛠️Lesson 5: Events
      • ☺️Lesson 6: Face recognition
      • 🔢Lesson 7: Variables and Functions
      • 💬Lesson 8: NLP
    • 🏫Blockly projects
  • Blockly Elements
    • ⚛️Misty Blocks
      • Movement
      • Speech
      • Audio
      • Vision
      • Events
      • Miscellaneous
      • NLP
      • System
    • 🔁Basic Blocks
      • Logic
      • Loops
      • Math
      • Text
      • Lists
    • 🅰️Advanced Blocks
      • Variables
      • Functions
  • Python
    • 🐍Python Lessons
      • 🦿Lesson 1: Loco-motion
      • 🤖Lesson 2 : Build a character
      • 🧠Lesson 3: Create memories
      • ⚒️Lesson 4: Event skills
      • 👀Lesson 5: Expand awareness
      • 🔗Lesson 6: Compact code
      • 🗣️Lesson 7: Start a conversation
  • Python Elements
    • 🐸Misty Python API
      • Motion and Mobility
      • Display and LED
      • Record Assets
      • Change/Remove Assets
      • Stream Assets
      • Get Assets
      • Events
      • Sensor Events
      • Speech and NLP
      • Arduino Backpack
      • System
      • Slam
    • 📗Python Definitions
  • Python Projects
    • 🔮MistyGPT
    • 🚨Misty Intruder Alert
    • 📺Conference Assistant
    • 🏷️QR code detector
    • 🕵️‍♂️Misty follow human
    • 👋Misty wave back
    • 🖲️Misty OA
    • 🌐Get weather
    • 🚚Misty Delivery
    • 🫂Motivational Misty
    • 🖼️Misty Museum Guide
    • 🎃Who for Halloween
  • ARDUINO
    • ♾️Arduino Backpack
    • 🦎Arduino
    • 🔧Arduino Lessons
      • 🔌Arduino to Misty
      • ➕Misty to Arduino
  • ARDUINO PROJECTS
    • 🛠️Misty Tracker
    • 🦾Misty Arm
  • Community Projects
    • 🌤️Misty weather forecaster
  • HARDWARE EXTENSION
    • ⚙️Arduino breadboard support
    • 🦾Misty arm
    • 🥤Tin holder
  • Resource Database
    • 📁Image files
    • 📁Audio files
    • 📁Languages
    • 📁Known objects
    • 📁NLP Actions
    • 📁Action Commands
    • 📁ChatGPT PDF files
    • 📁AR Tag Dictionary
    • ⚙️Technical Specifications
Powered by GitBook
On this page
  • DisplayImage
  • DisplayText
  • DisplayVideo
  • DisplayWebView
  • ChangeLED
  • TransitionLED
  1. Python Elements
  2. Misty Python API

Display and LED

This section contains all of Misty's APIs related to changing the display and LED.

DisplayImage

Displays an image on Misty's screen. You can use this command to display images from Misty's local storage or to display images that are hosted on the web.

Example Code

misty.display_image("e_Joy.jpg",1)

Misty uses the default image layer settings the first time she draws content with the DisplayImage command. You can use the SetImageDisplaySettings command to adjust the settings and change the appearance for a specific image layer. Issuing a SetImageDisplaySettings command redraws the updated image layer on Misty's display.

Parameters

misty.display_image(self, fileName : str = None, alpha : float = None, layer : str = None, isURL : bool = None)
  • FileName (string) - Filename for the image to display. Valid image file types are .jpg, .jpeg, .gif, .png. Alternately, if IsUrl is true, the URL path for the image to display.

  • Alpha (double) - Optional. Opacity for the layer on which the image displays. A value of 0 is completely transparent; 1 is completely opaque. When you specify a value greater than 0 and less than 1, the layer appears but is transparent. Defaults to 1.

  • Layer (string) - Optional. The display layer to create or update with this command. If null or not supplied, the image displays on the default image layer (named DefaultImageLayer).

  • IsUrl (boolean) - Optional. If true, the system treats the string you pass in for FileName as the URL address for an image hosted online.

DisplayText

Misty uses the default text layer settings the first time she draws content with the DisplayText command. You can use the SetTextDisplaySettings command to adjust the settings and change the appearance for a specific text layer. Issuing a SetTextDisplaySettings command redraws the updated image layer on Misty's display.

Example Code

misty.display_text("Hello world, my name is Misty")

Parameters

misty.display_text(self, text : str = None, layer : str = None)
  • Text (string) - The text to display.

  • Layer (string) - Optional. The layer on which to display the text. You can use this parameter to create a new text layer or to update an existing text layer. If not supplied, the text displays on the default text layer (named DefaultTextLayer).

DisplayVideo

Plays a video on Misty's screen.You can use this command to play videos you upload to Misty or videos that are hosted on the web. Use the SaveVideo command to upload a new video asset to your robot.

Example Code

misty.display_video("MyHomeVideo.mp4")

Misty uses the default video layer settings the first time she draws content with the DisplayVideo command. You can use the SetVideoDisplaySettings command to adjust the settings and change the appearance for a specific video layer. Issuing a SetVideoDisplaySettings command redraws the updated video layer on Misty's display.

The DisplayVideo command has the following limitations at this time:

  • You cannot use the DisplayVideo command to play video recordings that Misty creates with the StartRecordingVideo command. Misty can only play user-uploaded videos on her display.

  • Misty does not play audio for the videos she plays on her display.

Parameters

misty.display_video(self, filename : str = None, layer : str = None, isURL : bool = None)
  • FileName (string) - Filename for the video to play, with the file type extension. Valid video file types are .mp4 and .wmv. Alternatively, if IsURL is true, the URL path for the video to play.

  • Layer (string) - Optional. The display layer to create or update with this command. If null or not supplied, the video plays on the default video layer (named DefaultVideoLayer).

  • IsUrl (boolean) - Optional. If true, the system treats the string you pass in for FileName as the URL address for a video hosted online.

DisplayWebView

Misty uses the default webview layer settings the first time she draws content with the DisplayWebView command. You can use the SetWebViewDisplaySettings command to adjust the settings and change the appearance for a specific webview layer. Issuing a SetWebViewDisplaySettings command redraws the updated webview layer on Misty's display.

Example Code

misty.display_web_view("https://www.youtube.com/")

Important! Displaying webviews can consume a lot of computational resources. If you notice Misty's performance decrease while multiple webviews layers are active, you may consider deleting one or more webview layers.

Parameters

misty.display_web_view(self, url : str = None, layer : str = None)
  • URL (string) - The URL for the web page to display.

  • Layer (string) - Optional. The display layer to create or update with this command. If null or not supplied, the webview displays on the default webview layer (named DefaultWebViewLayer).

ChangeLED

Changes the color of the LED light behind the logo on Misty's torso.

Example Code

misty.change_led(125, 80, 30)

Parameters

misty.change_led(self, red : bytes = None, green : bytes = None, blue : bytes = None)
  • Red (byte) - The red RGB color value (range 0 to 255).

  • Green (byte) - The green RGB color value (range 0 to 255).

  • Blue (byte) - The blue RGB color value (range 0 to 255).

TransitionLED

Sets Misty's LED to transition between two colors. When you use this command, Misty will continue the transition you specify until she is powered off or receives another command to change or transition her LED.

Example Code

misty.transition_led(200,24,0,100,80,30,"Breathe",500)

Parameters

misty.transition_led(self, red : bytes = None, green : bytes = None, blue : bytes = None, red2 : bytes = None, green2 : bytes = None, blue2 : bytes = None, transitionType : str = None, timeMs : float = None)
  • Red (byte) - The red RGB color value for the first color (range 0 to 255).

  • Green (byte) - The green RGB color value for the first color (range 0 to 255).

  • Blue (byte) - The blue RGB color value for the first color (range 0 to 255).

  • Red2 (byte) - The red RGB color value for the second color (range 0 to 255).

  • Green2 (byte) - The green RGB color value for the first color (range 0 to 255).

  • Blue2 (byte) - The blue RGB color value for the first color (range 0 to 255).

  • TransitionType (string) - The transition type to use. Case sensitive. Accepts Blink (continuously blinks LED between the specified colors), Breathe (continuously fades LED between the specified colors), and TransitOnce (blinks LED from first color to second color only once).

  • TimeMs (int) - The duration (in milliseconds) between each transition. Must be greater than 3.

Last updated 1 year ago

🐸