ВКЛ / ВЫКЛ: ИЗОБРАЖЕНИЯ: ШРИФТ: A A A ФОН: Ц Ц Ц ЦНАСТРОЙКИ:
Центр цифрового образования на базе 169 школы (Санкт-Петербург)
191024, Санкт-Петербург, Харьковская ул., д.13А
417-32-50 (директор, канцелярия, заместитель директора по УВР в начальной школе), 417-32-51 (заместители директора по УВР, ВР)
sch169.centr@obr.gov.spb.ru

Центр цифрового образования на базе 169 школы (Санкт-Петербург)

МЕНЮ
МЕНЮ

Advanced Arduino Extension v3.1 for mBlock

Author: Aleksandr Grigorev

What is "AdvancedArduino"    (Русское описание расширения Advanced Arduino Extension v1.0 for mBlock)

1539252436

"AdvancedArduino" is an extension for the mBlock visual programming environment , which can be used instead of basic "Arduino" extension, and has a lot of extra options when working in Arduino mode.

  • new blocks for a number of the most popular library functions of Arduino IDE (min(), max(), constrain(), map(), pow()), intended for converting values;
  • additional blocks for working with serial communications (Serial, and also Serial2);
  • most basic blocks named with classic library function names (like "digitalRead"); 
  • "def" and "code" blocks allows inclusion of custom code snippets written in "Wire" (Arduino IDE) programming language;
  • ability to use any library functions of Arduino IDE in the code snippets;
  • option to define custom functions that return values of arbitrary type;
  • ability to use global and local variables and function parameters of arbitrary type, including arrays.

 

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 ().

image 084

 

 

 Installing the AdvancedArduino Extension

First method

 

  • Run mBlock and select Extensions -> Manage Extensions from the menu. The extension list will be downloaded from MakeBlock website.
  • Type "AdvancedArduino" in the "Search" field. You will see the "AdvancedArduino" element on the list.
  • Click on the "Download" button of the "AdvancedArduino" element.

 

Second method

  • Run mBlock and select Extensions -> Manage Extensions from the menu, then click on the "Add Extension" button.
  • Select the file type "zip-file", scroll to the downloaded archive, then click on the "Open" button.

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

 

Sample 1 ( file)

Blocks with custom code snippets (Arduino IDE code, "Wire" programming language) in a graphical script.

1539252786

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.

 

 

Sample 2 ( file)

Рort number in the function parameter.

1539252853

 

Sample 3 ( file)

"Counter" block and "repeat" loop (use Serial monitor).

1539252890

 

Sample 4 ( file)

Рort number in the function parameter and "counter" block.

1539252922

 

Sample 5 ( file)

Transmitting of messages from Serial2 to Serial, an explicit conversion of the value to char type.
Use with ME Auriga or Arduino Mega 2560, use "Auriga Program" header or "Advanced Arduino Program" header.

1539252971

 

Sample 6 ( file)

Blocks with library Arduino functions (value conversion functions).

1539253003

Sample 7 ( file)

Variables of any digital type (demo of overflow with byte variable).

1544087761

Sample 8 ( file)

Variables of any digital type (how to calculate factorial).

1544087796

 

Sample 9 ( file)

Using arrays.

1544087829

 

 

Sample 10 ( file)

Define custom functions that return values.

1544087875

 

Sample 11 ( file)

The "line" addition of the custom code snippets.

1539253154

 

Sample 12 ( file)

Using the text file saved on the disk.

1539253179

 

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:

1539253229

 

 

Sample 13 ( file)

2D arrays (multiplication table).

1544087953

 

Sample 14 ( file)

String variables.

1544088031

 

 

Sample 15 ( file)

"Length" method with String objects. Names matching (visual blocks and text code).

1544088076

 

 

Sample 16 ( file)

Morse transmitter based on mCore controller.

1544088120

 

"morse-ext-Dat.txt" file

image 017

 

Sample 17 ( file)

Array of functions

1544088182

Sample 18 ( file)

Running shadow processes (use the name "myUpdateFunction" for your custom block).

1544088256

Sample 19 ( file)

Several shadow processes. Use mBot educational kit with Servo Pack and 3-axis Gyro module

1544088387

Sample 20 ( file)
Shadow processes. "Static" local variables.

1544088417

Sample 21 ( file)

Shadow processes. "Static" local variables with similar names.

image1

Sample 22 ( file)

External interrupts. Use names "myHandlerFunction0", "myHandlerFunction1", etc. for your custom blocks. Use "volatile" variables.

1544088478

Sample 23 ( file)

Compound operators. Increment, decrement, side-effects.

1544088510

Sample 24 ( file)

Scheduled processes. Use names "myScheduledFunction1", "myScheduledFunction2", etc. for your custom blocks.

1544088543

 

Навигация

© 2024. .