Many interesting projects are coded on Arduino IDE thus making it very easy to get a head start with project. Just like Realtek Ameba RTL8722, there are many interesting project worth trying out, like BLE, MQTT with TLS etc. However, once the project grows in length and complexity, it becomes super inconvenient with the lack of code completion, hinting and jumping to definition features that are commonly available on most popular code editors. However, there is actually a way to have all those features with only 3 steps, here is how,
(Note: there are probably other ways of achieving the same goal, so share your method if you know a better way;)
- Go to “preference” under Arduino IDE and select “use external editor”
With this option selected, you will see the arduino editor grey out and become unable to edit code anymore, don’t worry, this is ok.
- Download and open any of your favourite editor which has all these “smart features”
In this case, Visual Studio Code is used for demonstration.
- Create a folder to store all your sketches and add Ameba RTL8722 ‘s arduino library to the workspace
(this 3.0.4 is the ameba library folder and it is usually located in you C drive under “C:\Users\YOURUSERNAME\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD”)
And also don’t forget to add your own sketch folder to the workspace (here my sketch folder is named “arduino_sketch” as seen above).
With these steps done, it will only takes a couple of seconds before the editor parse each and every files in the folders added and link all symbols together.
Now you will be able to code in your favourite editor and also to have these convenient features,
Code Completion & Code Hinting
Every time you save the sketch you just modified, just click anywhere of the grey area on the arduino editor and it will be automatically updated with your latest modifications, so you will still be able to one-click compile/download your code using the “Verify” or “Upload” button.
Hope you find it useful and share with me how you like to code for Arduino project