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
  • Numbers
  • Operations
  • Check
  • Other operations
  • Change variable
  • Lists operations
  1. Blockly Elements
  2. 🔁Basic Blocks

Math

Last updated 1 year ago

The Math folder in Blockly is supposed to be useful for performing mathematical operations. It contains blocks for basic arithmetic operations (+, -, *, /), as well as more advanced operations such as trigonometry, exponents, and logarithms.

The Math folder also contains blocks for working with variables, functions, and conditional statements. This allows you to write complex mathematical expressions in Blockly.

The description of this page will be particularly summarized because it will contain mostly mathematical elements and numbers to use in the other functions described.

Numbers

The first block identifies a general number. It is also the most used one to program Misty because when you need to specify an action, like how many meters to drive, you will need to use this block to give the number.

The second block (π), returns the common constants: π (3.141...), e (2.718...), Φ (1.618...)

sqrt(2) (1.414...), or ∞ (infinity).

The third block (sin 45), returns the trigonometry functions (sin, cos, tan, asin, acos, atan) in degrees, not radians.

The difference between the black and the blue box for a number is that the blue one is bound to that expression, instead the black one is not.

The fourth block (square root 9), returns some common mathematical functions (square root, absolute, negative, ln, log10, e^, 10^).

Operations

With this block, you can do several operations like +,-,*,/,^ between two numbers.

Check

This block checks if a number is even, odd, prime, whole, positive, negative, or divisible by (it depends on what the user clicks) and returns true or false.

Other operations

It is really intuitive to understand what these blocks do in Blockly:

  • The first block rounds up or down the number;

  • The second block constrains a number between a chosen range;

  • The third block returns the remainder of a division;

  • The fourth block generates a random fraction;

  • The fifth block generates a random integer in a range and is often used to create random sequences of lights with the misty RGB chest LED.

Change variable

With this block, you can select a variable in your code and change it according to the number written in the blue box.

Lists operations

This block is associated with a list of items that can return a sum, a minimum, a maximum, average, median, modes, standard deviation and a random item. So all the common statistic operations that you can do. This can be helpful in developing a program for Misty where you can extract a random name from a list or so.

type of numbers in Blockly
operations block
check block
other operations blocks
change variable block
lists operations blocks