Difference between revisions of "Mixly Block Category - Math"

From Microduino Wiki
Jump to: navigation, search
(Constrain)
(Random Integer)
Line 30: Line 30:
 
*max (right input) - upper bound of the random value, exclusive
 
*max (right input) - upper bound of the random value, exclusive
  
i.e. random('''5''', '''77''') will return a value between '''5''' and '''76'''.
+
Example: random('''5''', '''77''') will return a value between '''5''' and '''76'''.
  
 
Read more here: https://www.arduino.cc/en/Reference/Random
 
Read more here: https://www.arduino.cc/en/Reference/Random

Revision as of 21:34, 15 February 2017

Number Value

Numeric value which can be assigned to a variable or used in function parameters.

Arithmetic Operations

Performs the arithmetic operations on the left input with the right input. Then returns that value. Variables can be used to inputs.

Trigonometry Function

Number Function

Max / Min

Random Integer

Returns a random integer between the two input values.

  • min (left input) - lower bound of the random value, inclusive (optional)
  • max (right input) - upper bound of the random value, exclusive

Example: random(5, 77) will return a value between 5 and 76.

Read more here: https://www.arduino.cc/en/Reference/Random

Constrain

Constrains the Input to the Low and High and returns it.

  • Input - Variable or value that will be constrained.
  • Low - Lower value that Input will be constrained to.
  • High - Upper value that Input will be constrained to.

Example 1: Input is 10, Low is 5, and High is 15. Constrain returns 10.

Example 2: Input is 100, Low is 5, and High is 15. Constrain returns 15.

Example 3: Input is 2, Low is 5, and High is 15. Constrain returns 2.


Read more here: https://www.arduino.cc/en/Reference/Constrain

Map