Search on blog

Follow us on facebook

Top sellers

Information

VISUAL MICRO for ATMEL STUDIO FEATURES

Published : 09/18/2018 15:28:30
Categories : Proto Shield Plus



VISUAL MICRO for ATMEL STUDIO FEATURES


This is not intended to be an exhaustive tutorial covering all the features of Visual Micro for Atmel Studio, it is just a sneak peek to the features that intrigued me to evaluate this IDE.


First of all let’s open an Arduino sketch file


Let’s start opening an existing .ino file.

i.e. Let’s open the APSP_demo_I2C.ino available from the Proto Shield Plus sample sketches (https://www.gtronicsshop.com/en/index.php?controller=attachment&id_attachment=2).

Open INO file in Atmel Studio

Open INO file in Atmel Studio

Open INO file in Atmel Studio


Once opened, your code will be shown in the code window.

Open INO file in Atmel Studio

We’re now ready to start discovering some nice and useful Visual Micro IDE features.


Expand / contract code sections


For each “section” (code function or comment block) you can contract the section for a more readable code.
Expand and Contract code sections in Visual Micro For Atmel Studio

By clicking on the “-“ symbol the section will contract.
Expand and Contract code sections in Visual Micro For Atmel Studio

By clicking on the “+“ symbol (or double clicking on the “…” symbol) the section will expand.


Show line numbers


OK! This is not a key feature since it is present even in the “standard” Arduino IDE, but it could be handy in this document and it has to enabled in Visual Micro for Atmel Studio.
Tools->Options->Text Editor->All Languages->Line numbers

Enabling Line numbers in Visual Micro For Atmel Studio

Enabling Line numbers in Visual Micro For Atmel Studio


Direct jump to the desired function


On the top left of the code window you will find a drop down menu, it shows all the functions (methods) in your sketch.
Just click on the desired function and you will directly jump to its code implementation.

Direct jump to the desired function in Visual Micro for Atmel Studio


Bookmarks (and Text Editor toolbar)

Another way to jump up and down in the code is using bookmarks.
Select a line and then click on the Toggle a bookmark on the current line button Bookmarks in Visual Micro for Atmel Studio to set a bookmark on the current line.


Bookmarks in Visual Micro for Atmel Studio


Use the other buttons to navigate through the bookmarks and to manage them

Bookmarks in Visual Micro for Atmel Studio
In the Text Editor bar you will also find the buttons to increase or decrease indent

Bookmarks in Visual Micro for Atmel Studio
and the buttons to Comment or Uncomment selected lines

Bookmarks in Visual Micro for Atmel Studio
These two function are present in the standard Arduino IDE too, but it worth mentioning them since they are very used.



Direct view or jump to constant or variable definition


Let’s assume you would like to jump to the definition btnNONE (see line 103 of the APSP_demo_I2C sketch), just click on btnNONE, it will be highlighted in light blue, the same highlight will be applied to all the other btnNONE in the code (notice that even btnNONE on lines 91 and 79 are highlighted in light blue).

Direct view or jump to constant or variable definition in Visual Micro for Atmel Studio

You will also notice that the Context Bar shows your current selection and the Definition bar shows the definition of btnNONE.

Direct view or jump to constant or variable definition in Visual Micro for Atmel Studio


By clicking on the “GO” button on the right of the Definition bar, you will jump to the btnNONE constant implementation.

Direct view or jump to constant or variable definition in Visual Micro for Atmel Studio

Direct view or jump to constant or variable definition in Visual Micro for Atmel Studio


The same applies to variable definitions: select lcd_key on line 91, all the lcd_key will be highlighted and the Definition bar shows the definition of lcd_key variable.

Direct view or jump to constant or variable definition in Visual Micro for Atmel Studio

Of course, by clicking on the “GO” button, you will directly jump to the implementation of lcd_key.

Direct view or jump to constant or variable definition in Visual Micro for Atmel Studio

Now experiment by yourself with the Definition bar and discover all its power, for example you can directly dig into libraries (.h and .cpp files) to discover how they are implemented….


Try to select setBacklight on line 63 and then click the “GO” button, you will notice that you can open and navigate in the .h or the .cpp implementation in the LiquidCrystal_I2C class.


Now try to select on line 3 and see what the Context bar shows and what happens if you click on the “GO” button…


Easy access to find and rename

By selecting any word (variable, constant, command, etc.) and leaving the cursor over the selected word, a little icon appears next to it Easy access to find and rename in Visual Micro for Atmel Studio

Easy access to find and rename in Visual Micro for Atmel Studio


Click on the icon to open the refactoring menu.

Easy access to find and rename in Visual Micro for Atmel Studio


This menu lets you quickly access the Find and Rename (Replace) features.


Find

By clicking on Find References the VA Find References Results window will open.

Easy access to find and rename in Visual Micro for Atmel Studio

Double clicking on each row will lead you to the selected row in the code window.


Rename (Replace)

By clicking on Rename (better known as “Replace” in most of the other software) the Rename window will open.

Easy access to find and rename in Visual Micro for Atmel Studio

The Rename window lets you choose the new name (i.e. adc_key_in will be renamed to adc_key_in_raw).

The windows shows the opened projects and files and all the occurrences of the selected word.

You can select or deselect the single projects, files or occurrences.

Easy access to find and rename in Visual Micro for Atmel Studio

By clicking on Rename button all the matched words in the selected projects, files and occurrences will be renamed (replaced) with the new name.


Track Changes


Following the example shown in the previous chapter, you will notice that as soon as you click on the Rename button all the adc_key_in became adc_key_in_raw.
In addition, a yellow bar on the left of the code shows that those lines have been modified since the last file opening

Track Changes in Visual Micro for Atmel Studio

Once the file has been saved, all the yellow bars became green showing you that the file has been modified and the changes are saved.

in Visual Micro for Atmel Studio
It helps you to keep track of all changes while writing code.


Spell check


It is not so bad to have a spell check in the editor too...

Spell check in Visual Micro for Atmel Studio


Word wrap


Tools->Options->Text Editor->All Languages->Word wrap

Word wrap in Visual Micro for Atmel Studio

Word wrap in Visual Micro for Atmel Studio

I suggest you to check even Show visual glyphs for word wrap

Word wrap in Visual Micro for Atmel Studio

In addition, with line numbering enabled, it is quite easy to see when the line is “wrapping”.


Splitting the Code Window


By clicking on the Split window handle, you can drag it and split the code window in two section.
It is quite useful when you have to work on different part of code at the same time.

Split the code window in Visual Micro for Atmel Studio

Split the code window in Visual Micro for Atmel Studio


Surround code with (code snippets)


If you want to easily surround a code section into an "if" statement (i.e.), just select the desired lines of code and then right click on the selection: a pop-up menu appears.
Use Surround with (VA), Insert Snippet or Surround with (they are all quite the same) to surround your selection with the desired snippet (do, if, while, etc.).

Surround with (code snippets) in Visual Micro for Atmel Studio

Surround with (code snippets) in Visual Micro for Atmel Studio
Of course, you have to replace "expression1" with your desired expression.


Extract Method


If you want create a method (or function, call it whatever you like it…) starting from a part of your code, just select the part of your code and then right click on the selection.
Click on Refactor (VA)->Extract Method

Extract Method in Visual Micro for Atmel Studio


Insert the name of your new method and then click OK

Extract Method in Visual Micro for Atmel Studio

The selected code will be moved to a new method and your selection will be replaced with the call at the new method.

Extract Method in Visual Micro for Atmel Studio


Direct jump to compiler errors


This function was not present in the old Arduino IDE, now it is present in it too, anyway it worth mentioning this feature since it is very useful.
The compiler will report all the errors in the Output window, double click on the error (if errors are present, of course!) and the code window will directly jump to the error in your code.

Direct jump to compiler errors in Visual Micro for Atmel Studio


Compile and upload speed


You will probably notice that compiling and uploading the sketch to the Arduino board are quite faster than with the standard Arduino IDE.


Auto Completion


You will also benefit of the auto completion which helps a lot while writing code…

16. Auto Completion in Visual Micro for Atmel Studio

It is case “insensitive” too and it is very very useful…..

16. Auto Completion in Visual Micro for Atmel Studio

Conclusion


As mentioned at the beginning of this article, this is not intended to be an exhaustive tutorial covering all the features of Visual Micro for Atmel Studio, it is just a sneak peek to the features that intrigued me to evaluate this IDE.
If these features are intriguing you as well, just give Visual Micro a try and discover other features that fit your needs, expectations and skills.


In the next article we will finally look at the debug features of Visual Micro IDE…




Share this content