Knowledge Base

How Do I Create a New Smart Block?

output-onlinepngtools__231_.png spike_robot.jpg Smart Blocks work for EV3, SPIKE™, Zappy, and Ruby! zappi1_flip.png output-onlinepngtools__101_.png

Smart Blocks are a great way to improve your coding skills and speed up your progress. They are basically a way to create functions.

77688-logo-computer-youtube-icons-free-hq-image.png  Check out this video tutorial on YouTube.

To create a Smart Block simply follow these instructions:

  1. Click the 'Add Smart Block' button  ic_playlist_add_black_24dp_2x.png  in the Blockly tool bar.
  2. Click '+ New Smart Block'. A pop up will open.
  3. Name your Smart Block and click 'Create'.
    Note: your Smart Block's name should be short and meaningful, and can include letters and numbers, but cannot include empty spaces or unique symbols. Here are some examples:
    Do Don't
    Turn90Right  turn 90 degrees to the right
    Drive10sec newblock!
    DriveSquare smart block #2
       
  4. A new Blockly tab will open with a 'define' block.
  5. Add your code within the define block.
    When done, simply click the 'Main' tab to go back to your main code editor.
  6. Open the Smart Blocks category.
    Your newly created Smart Block will be available there as a 'Call [SmartBlockName]' block.
    When your code is executed, the Call block will cause the code in your Smart Block to run

Here is how to create a Smart Block that will make your robot turn 90 degrees to the right:

creating_smart_block_english.gif

 

Tips and Tricks - and a word of caution!

You can duplicate, remove, edit, clear, and delete a Smart Block from your user by clicking the options icon  mceclip1.png  when inside your Smart Block tab:

mceclip0.png

Keep in mind that doing any of these in one mission or project will result in the action being performed throughout your user. Tread with caution!

mceclip2.png

Was this article helpful?
2 out of 3 found this helpful

Comments

Please sign in to leave a comment.