Block Descriptions

mbot-program – This header block indicates the program will be translated in to Arduino code and uploaded to the mCore board.

wait – The program waits for the time input

play-note – The note selected is played on the on-board buzzer for the length selected.

forever-block – A forever loop – all the code inside the loop will run forever

led-block – Sets the LEDs – can select the left LED, the right LED, or both LEDS and any value of red, green and blue between 0 and 255.

run-forward-block  – Moves the mBot – options are forward, backward, left or right, speed between -255 and 255.

set-motor  – Can control the motors individually setting either M1 or M2 to a power setting between -255 and 255.

less-than-block  – The Less-Than Operator.  If the thing you put in the left hand side is less than the thing you put in the right hand side, this block will evaluate as true, otherwise it will be false.

ultrasonic-sensor-block – This returns the value of the ultrasonic sensor in centimetres.  Possible values are between 3 and 400.  You need to make sure the right port is selected.

light-sensor-block  – This returns the value of the light sensor.  Possible values are between 0 and 1023 with 0 being dark and 1023 being light.

if-block  – If the condition in the top line is true, the code inside this block will be executed, otherwise it won’t.

random-block – This will return a random number between the 2 numbers you enter.

and-block  – This will return true if the thing in the left AND the thing in the right both return true.

line-follower-block – This returns the value of the line follower sensor as follows: 0 – no light reflected, 1 – light reflected to right side, 2- light reflected to left side, 3 – light reflected to both sides.  You need to make sure the right port is selected.

line-follower-boolean-block – Returns true or false.  Correct port must be selected and then the side of the sensor and whether you are testing for black or white.

make-a-variable – This button creates a variable.

variable – This block returns the value of the variable.

setvariable– Sets the variable selected to the value input on the right.

changevariable – Adjusts the variable selected by the amount input on the right.

reset-timer-block – resets the on-board timer to 0 (the timer immediately starts counting).

timer-block – Returns the value of the timer in seconds.

boolean-button-block – Boolean block that has pressed or released as its options.

button-header-block – Can only be used from the mBlock environment.  Triggers the code below this block to be run when the on-board button is either pressed or released.

make-a-block – Creates a block (function)

block-call  – calls a function, with the option of passing parameters.

define-block – The header block for a block (function).  Code attached to this header block will be run when the function is called.

parameter – Returns the value of the parameter.

send-message-block – sends a message out via infrared.

receive-mbot-msg – returns any message the mBot has received via infrared.

data-available-block – This block is used to verify whether the mBot has received data via serial communication.

is-equal-block – Used to check if two strings are equal.  Usually used to check that a line read from the serial communication matches a certain string.

read-line-block – Returns a line read from serial communication.

write-line-block – Sends a line through serial communication.