Mixly Block Category - Microduino - Core

From Microduino Wiki
Jump to: navigation, search

Waiting (While)

This block works as a while loop. This will wait until the condition / condition statement becomes false. This is useful to wait until a variable or a pin become a certain condition.

  • Condition / Condition Statement - the waiting (while) loop holds / waits until this condition is false.

Example:

Waiting digitalRead PIN# 1

If initially pin#1 is true (high), then this example will wait until pin# 1 is false (low).

While Loop

This block acts the same as a while / repeat loop. Will loop continuously, and infinitely, until the expression or variable becomes false. Something must change the tested variable, or the repeat loop will never exit. This could be in your code, such as an incremented variable, or an external condition, such as testing a sensor.

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

For Loop

This loop works simliar to the count loop. The count statement is used to repeat a set of blocks enclosed. An increment counter is usually used to increment and terminate the loop. The count statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins.

There are three parts to the count loop:

  • i - This is the variable name that will be incremented or decremented.
  • From - The starting value of i
  • To - The ending value of i
  • Step Value - The value to add for each loop to i

1. The loop first checks if it meets the conditions (if i is within the lower and upper bound values) to execute the set of blocks enclosed. If true, then they will be executed. If fail the loop ends.

2. Once 1 loop cycle has occurred the i is incremented by the Increment value, then repeats to step 1.


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

Analog Write

Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analog write the pin will generate a steady square wave of the specified duty cycle until the next call to analog write (or a call to digital read or digital write on the same pin).

The value X between 0 and 255 will output the (X/255) * Maximum Voltage (5V/3.3V) on the pin.


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

Analog Read

Reads the value from the specified analog pin. Returns a value between 0 and 1023. The return value is a map of input voltage (0V to 5V/3.3V) to a value between 0 and 1023.


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

Serial Availability

Get the number of bytes (characters) available for reading from the serial port. This is data that's already arrived and stored in the serial receive buffer (which holds 64 bytes). available() inherits from the Stream utility class.

  • Serial Port - For that specific serial port check if there is an available.


Read more here: https://www.arduino.cc/en/Serial/Available