Mixly Block Category - Lists

From Microduino Wiki
Jump to: navigation, search

Create List

Creates a List. Lists are a collection of variables. Access to each variable is done by the index number. This allows accessing variables simple with a counter that increments to go through an entire List.

  • List Type - This defined the data type that the List will hold. There are choices between int (for integers), float (for decimal numbers), and char (for characters).
  • List Name - This is the name of the List. The List's name is used in other blocks to access the List. The name is arbitrary.
  • List Size - The size of the list allows 3 variables by default. But this can be configured. Click on the gear icon to add or remove the number of items by dragging items into or out of the List object.

With Blocks

Data can be initialized to the List by dragging their blocks into the List. Variables can be added to the List.

With Text

List can also be define in text format. Instead of individually snapping blocks to the List construction. A specialized string of text (basically code) will define the List. The format is item1, item2, item3, item4


Note: Be aware that Lists are made a the very start of the program. Even before setup() occurs. Therefore, be mindful of what is being assigned.

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

List Length

Returns the length or the number of elements in the List. The input is the name of the List. As defined during the construction / initialization of the list.


Read more here: https://www.arduino.cc/en/reference/sizeof

Accessing Item in List

Returns the element / variable / value that is at the index of the List.

  • List Name - This the name of the List as defined in the construction / initializer.
  • Index Number - This is the index number that is being requested.

Note: Index numbers start at 0 for the first element. The last element's Index number is the size of the List - 1.


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

Setting / Storing Item in List

Sets / Stores / Assigns the element / variable / value that is at the index of the List.

  • List Name - This the name of the List as defined in the construction / initializer.
  • Index Number - This is the index number that is being handled. This is where the variable will be stored.

Note: Index numbers start at 0 for the first element. The last element's Index number is the size of the List - 1.

  • Variable / Data - This is the data that will be stored on the List at the Index number.


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