Author: Aleksandr Grigorev
Download extension
Old version (v1.0):
What is "AdvancedArduino"
"AdvancedArduino" is an extension for the mBlock visual programming environment , which can be used instead of basic "Arduino" extension, and has the following extra options when working in Arduino mode:
Attention! The mBlock visual programming environment generates the Arduino code sketch using the "double" type for all variables and function parameters created in the visual mode. Do not forget, if necessary, cast the value to another type - int (), byte (), String ().
Installing the AdvancedArduino Extension
First method
Second method
If you have any questions, look at the additional instructions from the Makeblock developers:
http://www.mblock.cc/docs/create-extensions-for-mblock/
Examples of using the AdvancedArduino extension
Example 1
Blocks with custom code snippets ("Wire" programming language) in a graphical script.
Attention! When mBlock generates Arduino code sketch it comments out the code () and def () block values using the /* and */ directives. To make the code fragment visible to the compiler, it is necessary to put the CLOSE "bracket" ( */ ) in the BEGINNING, and the OPEN “bracket” ( /* ) at the END. Mind that the mBlock automatically adds the pinMode () commands to the Arduino IDE sketch only when it encounters blocks like "digitalRead" and "digitalWrite" in the graphical script.
Example 2
Global and local variables, arrays and functions that return values.
Note that the global variable "SizeOfArray" is of a double type, in this example, an explicit conversion of the value to another type is used: byte(SizeOfArray).
Example 3
Boxes with library functions Arduino IDE
Example 4
The "line" addition of the custom code snippets.
Note that in the text field of the first "Serial println" box, you need to enter the character <space> (ASCII 32), in this case mBlock adds the command Serial.println () to the Arduino IDE sketch. If there is an empty line inside the text field, the command Serial.println (0) is generated instead.
Example 5
Using the Wire code saved as a text file on the disk.
The disk must contain a text file with the appropriate name and content. If it is necessary, change the path to this file in your script.
Contents of the text file:
sampleFunction:
void ascendingSort(int dt[], int SizeOfArray) {
for (int i=0;i<SizeOfArray;i++) {
for (int j=i+1;j<SizeOfArray;j++) {
if (dt[i]>dt[j]) {
int temp=dt[i];
dt[i]=dt[j];
dt[j]=temp;
};
};
};
};