Is Visual Micro the better Arduino IDE? Including ESP32 inline debugger

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
many of us want a better tool than the arduino ide with more functionality and still the same ease of use as we saw in an earlier video one way to go is platform io today we will test another tool that viewers proposed and see if it is any good visual micro crazy youtubers here is the guy with the swiss accent with a new episode and fresh ideas around sensors and microcontrollers remember if you subscribe you will always sit in the first row what are our wishes for a better arduino ide support for the arduino framework of course ease of use auto completion and error checking during typing easy navigation to variables and functions where they are defined and where used and of course a debugger for our esp32 or stm32 boards not too much to ask for in 2021 the arduino ide unfortunately only supports the first two platform io has it all and is an excellent tool for complex projects with different configurations and libraries but it has a learning curve that is not for everybody maybe visual micro can fit in between covering all wishes without the learning curve when i started with arduino back in the day i already used visual micro because it has a unique possibility for debugging via serial i was able to set breakpoints with an arduino without any additional cabling or hardware i left it when i started with the esp8266 which was not supported since then the tool has made quite some advances and today we can use it for different mcus and with or without a hardware debugger for programming we get the productivity features of a better arduino ide and for debugging the needed tools to stop the processor and inspect variables on the fly a feature completely missing in the arduino ide before we continue the tool is an add-on to the free version of visual studio and it costs 12 dollars per year for hobby usage with a six weeks free trial period it is developed by two british gentlemen tim and simon who have to get food and shelter especially in these hard brexit and corona times so this price is okay for me i also donate money for the arduino ide from time to time because these guys changed my life considerably and the licensing is fair without auto renew if you are still with me i tell you my experience with the tool to find out if it works i not only wrote a blink sketch no i used it to port my morsy trainer to the esp32 and free rtos a relatively complex project involving real-time aspects as well as an interrupt-driven ps2 keyboard interface this project also serves as a preparation for my planned rtos video but where shall we start as always the best is in media race like that you can later decide if it is worthwhile to install the tool here is how it looks like when you program with it i did not do a lot of user interface massaging and mostly use the default settings visual studio offers all the comfort to adapt these windows to your needs if you want you even can choose a dark design but because we want to keep our familiarity with the arduino ide i keep it blue and white let's start with navigation as said before this is the developer's view the main window displays the code and an overview for fast positioning the left window shows the project structure with all files and inside the files the functions you even see the global variables in the respective file and of course if you click on something your coding window automatically positions to this place and you can quickly work on a change for example the third window has a few tabs where you can find your compiler and linker's output and a powerful reference view called find symbol reference if you select any variable or function in the editor and press f12 you find where it is defined with shift f12 you see where it is used these two keys together with a backward and forward arrows are my main navigation buttons searching for a function or going back to where you came from is incredibly productive and with a right click we get to the rename menu also a cool feature because visual micro knows your variables and functions it only renames those not similarly sounding comments or part of other variables if you use search and replace for renaming variables in the arduino ide you know what i'm talking about also if you hover over variables or functions you get additional information you do not need to go to the variable definition if you just want to know if it is int or car for example the next topic is coding speed this topic has two parts out doc completion and error checking if you start to write the editor proposes matching texts if you open a parenthesis or a quotation mark it adds the closing parenthesis or the second quotation mark nothing special but comfortable it also counts the length of strings all minor things but we miss them in the arduino ide the second even more time saver is that the editor already shows you most of the syntax errors like that you do not need to compile your code just to find out you forgot a closing parenthesis for example it also shows you when you forgot to declare a variable but pay attention sometimes it shows errors where no errors are because it is not aware of a library function for example next we look at the essential menu points and the right selections for our arduino projects here we select our board you find all boards installed in your arduino ide and here we select the com port with this button on the right you can open the serial monitor i like its window docked but you can also have it floating if you want to put it on a different screen for example and here i always select debug here you can choose your hardware interface port for programming no programmer means that you upload via serial visual micro supports the usual boards like the esp proc or the olimex used in my platform i o video you find the relevant wiring diagrams for all boards on their home page for the esp32 we use the jtag standard so we have to connect five pins plus ground and 3.3 volts today i use the esp32 proc which seems to use the same chips as this f2232h port the main difference between those two boards is those handy connectors i show you later why i like them if i enable this button the uploading is done via the programmer hardware much faster than with serial also a nice feature and here we can select the hardware for debugging usually it is the same as for programming if you do not have one you still can choose serial we will later see the differences i strongly suggest using a hardware debugger for esp32 and stm32 projects here i always choose no project optimization for the compiler while debugging it seems that you can also choose default optimization all these selections are stored with your project and once selected you can't forget them with one exception if visual micro refuses uploading through the programmer because the board is in a weird status we have to switch enable programmer off like that the mcu is reset and the standard serial upload is selected the next time we can select enable programmer again that's it now we can hit start and visual micro does its thing it compiles and links the programs uploads it to the board and starts the debugger and the user interface changed to the run configuration with different windows like serial monitor the watch windows for variables or the call stack to find out where you code loops if you lost it now comes the hardware debugger's power even if the code runs we can go wherever we want in the code and set a breakpoint for example as soon as the program passes this line next time it stops and shows us the variables values in the watch window a few variables are automatically selected and we can add more if needed from there we can single step through the sketch we can jump over functions or dive into them if we are interested in their behavior but pay attention if you press step into you quickly get into the bowels of the arduino code or with the esp32 even worse into three rtos sometimes you do not find back and get this page and your code is locked this is why i do not use single step a lot i instead set a breakpoint and use continue or even more comfortable press this small arrow it is like an attack breakpoint and makes the code run till here by the way if we hover over the variables in the code we see their current value also very handy all this debugging is done without recompiling the code we even can define actions in a breakpoint and lock a variable every time the program passes by the program does not stop like adding a serial print statement but without recompiling how cool is that and here is the difference if we choose serial debugging instead of hardware debugging in this case visual micro automatically inserts serial print statements and other stuff into the code before uploading but we cannot add or change the place of a breakpoint during operation if we do so we have to recompile and upload again you see why i love hardware debugging we can only have 4 active breakpoints by the way this seems to be a limitation of gdb the open source debugger also used by platform io now a word of caution the esp32 does a lot of things you are not aware of for example wifi traffic runs in the background or free rtos also runs invisibly if you stop the code with a breakpoint or a single step the cpu can crash not because of your code but because of you blocked something important if this happens usually you get a panic message in serial and you have to restart the mcu this is not done by hitting the reset button the debugger would get crazy if you did that because the code is still on your board you just hit attach process and your code continues to run please add this line to the boards.txt file then your sketch always start from the beginning which is very important in the case of a crash without this line it would continue where it was with these debugging functions you quickly find out where you made a mistake or where you forgot something what else do we need to know visual micro has a youtube channel where you find videos on how to install the tool as well as tips and tricks if you want to know more no need to show it here i leave a link in the description and they have good documentation where you get much more details like how to deal with libraries etc those functions are similar to what platform io offers but i assume the casual maker will not use them i also leave a link to their forum where you will get support if needed and if you say hello to them from me they know where you come from if you start a new project you get several template projects i usually use the arduino simple empty project because i had an existing arduino project with an ino and many dot h files and libraries i created such an empty new project in a new folder outside the arduino sketch folder and closed visual micro now i copied all files from the arduino sketch folder into the visual micro folder the empty.ino file was overwritten as the last step i opened visual micro and imported the dot h files into my new project i strongly suggest only use one project per solution then f5 or the start button has the same functionality as upload or f9 on the arduino ide the libraries can stay where they are in the arduino libraries folder and the best if you want you can always come back and open the dot ino file with the arduino ide both environments are very compatible a big difference to platform io which is not backward compatible and other addition the esp prog debugger boards offers two ports if you only change interface 0 with sadiq you can connect the serial monitor through the remaining serial connection here is the diagram on how to connect the debugger as well as the serial pins to the esp32 in this configuration you can upload and debug your board without usb connection you even can work with custom boards without a usb to serial adapter coming back to the connectors i created these two cables and labeled them using my brother printer and printable heat shrink tubes very handy because now i know to which gpio pin i have to connect them finally what is my verdict if you are a casual arduino ide user and do not plan to create big projects with different versions and library dependencies visual micro is the best choice even if you only work with standard arduino boards or do not want to use a debugger only the comfort of intellisense showing you the errors before compiling or the automatically inserted quotation marks or parentheses is something you get used to and do not want to miss afterwards and the debugger really helps to find tricky errors and increase your productivity if you need more platform io probably is the better choice as we see for example with the tasmota project it uses all the cool configuration helpers to create hundreds of different variants with the press of a button but you have to learn more its look and feel are further away from the arduino ide and the code is no more backward compatible i have to say i paid the 12 before the three months were over and i enjoyed working with simon who helped me to get a grip on my complex rtos project this was all for today as always you find the relevant links in the description i hope this video was useful or at least interesting for you if true please consider supporting the channel to secure its future existence thank you bye
Info
Channel: Andreas Spiess
Views: 66,660
Rating: 4.9378309 out of 5
Keywords: app, application, arduino, arduino weather station, beehive, beekeeper, beginners, cloud, core, diy, do-it-yourself, eevblog, electronics, esp32, esp32 project, esp32 tutorial, esp8266, firebase, git, github, greatscott, guide, hack, hobby, how to, hx711, iot, led, lights, load, load cell, lora, lorawan, mqtt, nextion, nextion hmi, nextion project, nextion review, nodemcu, philips hue, projeect, raspberry pi, scale, simple, smart home, zigbee, Debugger, ESP32 debugger, STM32 debugger, Visual Micro, visual studio
Id: 7SiprW-goj0
Channel Id: undefined
Length: 17min 28sec (1048 seconds)
Published: Sun Mar 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.