Development Environments

Visual Studio Code

Before you can start setting up a Visual Studio Code environment you first need to download and install it. You can find the website to download it from here and you can find info about setting it up here.

Once you have this installed you are going to want to install the relevant extensions. First, you need to install python. Visual Studio Code describes how to install python in great detail here.

Python

Installing Python

Before you can start coding in python on VSCode you first need to install a python interpreter. There is a tutorial for this here. If you are on Windows simply download it from the Python.org website. If you are on macOS then look at the above-mentioned tutorial.

Getting the Python extension

You also need to install the Python extension. This can be found in the extensions tab.

../_images/Extensions_Logo.png

Search for Python and click Install.

../_images/Installing_Python_Extension.png

PyMakr

Installing NodeJS

To install PyMakr correctly you first need to install Node.js.

To do this first go to the NodeJS website

Click on the green button with LTS in the version name. Unless you need to install on a different OS in which case press “DOWNLOADS” on the ribbon bar and select the relevant download for your OS.

../_images/Installing_Node_Js_1.jpg

Once the download is done, run the installation and click the “Next” button.

../_images/Installing_Node_Js_2.jpg

Accept the license agreement and click “Next”.

../_images/Installing_Node_Js_3.jpg

Here you can specify the installation path. We recommend leaving it as is.

../_images/Installing_Node_Js_4.jpg

Make sure all the packages are marked to be installed (looks something like the image below).

../_images/Installing_Node_Js_5.jpg

You can check the box to install additional software/scripts that are required by some packages but for our use case, it won’t be necessary.

../_images/Installing_Node_Js_6.jpg

Now you can start the installation. Once the installation is done you need to restart your PC.

Install and setup PyMakr

Now you need to install the PyMakr extension by going to the extensions tab on the left and searching for Pymakr. Install this simply by clicking on the extension and then pressing the install button.

You may need to then restart your Visual Studio Code.

This should create a new tab at the bottom of your Visual Studio Code that looks like the image below:

../_images/Pymakr_Logo.PNG

Click on this and your sidebar will change to look like this:

../_images/Pymakr_Sidebar.PNG

Collapse “PROJECTS”. Now connect the serial port of your VBOX Touch to your PC. More details about how to do this can be found here.

Once you know your port’s COM Channel you should be able to find it in your list of devices with the same COM channel. You can either connect to the device and then press the “Create terminal” button that looks like a square around >.

../_images/Pymakr_Create_Terminal.png

Or you can open a terminal with either Terminal, New Terminal or pressing CTRL+Shift+’. Which will look something like this:

../_images/Terminal.png

Then in the top right of the terminal, there is a plus with a drop-down menu next to it. Press this drop-down menu and select PyMakr.

../_images/Open_Pymakr_Terminal.png

This should display the following:

../_images/Pymakr_Terminal.PNG

Then navigate to the relevant device and hit Enter. Then connect to the device using the “Connect Device” button that is shown below.

../_images/Connect_Device.png

This should connect you to your VBOX Touch and should now appear as the “Disconnect Device” button shown below.

../_images/Disconnect_Device.png

Your terminal for your VBOX Touch should have a normal terminal entry of >>>. Try typing print(“Hello World”) and see if it outputs “Hello World” back.

Using Visual Studio Code

Make sure to learn about some of the features that Visual Studio Code offers. We talk about one below with stubs. There are many more however, one of the most useful is the command palette which you can access with CTRL+SHIFT+p. You can read about this more here. We recommend learning some of the basic commands.

Development tips

Add all the files you need for your code except your main.py file to the SD Card. Instead, create a blank main.py. Then insert your SD Card in your VBOX Touch and power it on.

Connect to your device and cycle the power connection (this is due to a glitch that occurs when trying to copy your file across). You then need to be on the file you wish to send to the VBOX Touch (likely your main.py file) and use the built-in command “PyMakr: Run file or selection on device” (CTRL+Shift+R) and select your USB port and then press OK.

Stubs

Stubs are an incredibly useful feature of VSCode that allows for better code-completion aid and also validates that functions exist in modules you are importing.

Click here to download our list of stubs.

You then need to unzip this file and then move it to a relevant file path i.e. /VBOX_Touch/Development/Stubs.

Once you have done this go on to VS Code and go to File, Preferences, Settings (or press CTRL+,). From here search for “extra paths”. You will then have a window that looks like the one below:

../_images/VSCode_Stubs.PNG

Now you can either go into the .json file by pressing “Edit in settings.json”, or use the simpler method of copying and pasting the file path into the text box that is created when you press the Add Item button in the Extra Paths section.

Warning:

Ignore the “Watcher Include” section. Do not add your file path to this.

We recommend updating your stubs whenever there is a new firmware release as there will likely be new functionality added and hence new functions detailed in the stubs that you may want to use.

PyCharm

You may prefer a different code development environment. In this case, our next recommendation is PyCharm. This is a free IDE specifically for python that you can download here.

Now open the .exe file and follow the steps below.

Press “Next”

../_images/pycharm_install1.png

Check you are happy with the file path and then press “Next”.

../_images/pycharm_install2.png

We recommend creating the desktop shortcut. However, they are all optional. See the installation guide for more details.

../_images/pycharm_install3.png

Check you are happy with the name of the folder it is going to be placed in and then press “Install”.

../_images/pycharm_install4.png

The website also has ways to learn about the IDE and it is recommended, particularly if it is your first time using it, that you look through this. It can be found here.

Version Control

One of the most useful parts of PyCharm is its good version control development system that is built-in. This allows easier development using systems such as git. For more information about this see their website or click here.

Stubs

Like VSCode, PyCharm has stubs that are used with their “IntelliJ” system to allow the autocompletion of different things. These stubs can of course be changed in the following way:

Firstly you need to download our list of stubs. Once downloaded you then need to unzip this file and then move it to a relevant file path i.e. /VBOX_Touch/Development/Stubs.

Next, you need to add this to the stub file to the global stub collection to allow for easier development. In the bottom right of your screen click the project interpreter (It likely says Python 3.9).

../_images/pycharm_stubs1.png

Click “Interpreter Settings…”.

../_images/pycharm_stubs2.png

From here select the drop-down menu next to “Python interpreter:” and click “Show All”.

Note:

You may instead need to select the settings button to the side of the drop-down menu if you are running an older version of pycharm.

../_images/pycharm_stubs3.png

This should open a new window. In this window look for the folder with a subfolder symbol called “Show Interpreter Paths” and click this.

../_images/pycharm_stubs4.png

This should open another window named interpreter paths. From here click the add button and add the file path of the stubs you just downloaded and then press “OK”.

../_images/pycharm_stubs5.png

After doing this press “OK”, “Apply” and then “OK” again until you return to your original PyCharm window.