2. Workspace Setup

In this section, all the required software is installed. Visual Studio Code is used for the code development.

Todo

Please download the presented software with the links provided in their respective sub-sections.

2.1. Visual Studio Code

Visual Studio Code is a source code editor. It supports various programming languages and can be combined with compilers to work as a package integrated development environment IDE.

VS Code has IntelliSense which allows word based completions. This you can write code syntax without typos.

You also get access to various extensions. These enhance the working of VS Code and also adds new features as per requirements.

../../_images/vs_code_logo.png

Fig. 2.2 VS Code by Microsoft

Todo

Download and install Visual Studio Code.

Download Link: https://code.visualstudio.com/download

Todo

If you have not yet worked with Visual Studio Code before, follow this course on Visual Studio Code Basics

2.2. Arduino IDE Extension

The introductory programming sessions will be conducted using Arduino UNO board. The board can be programmed using C++. To write the code, the Arduino extension will be required in Visual Studio Code. This code will then be compiled using a GCC compiler and uploaded to the board using a flashing program. For uploading, the board has to be connected to the PC using a USB A (PC side) to USB B (UNO side) cable.

../../_images/Arduino_1.png

Fig. 2.3 Arduino Uno (ref: Arduino Store)

../../_images/development_workflow.png

Fig. 2.4 Development Workflow (ref: Real-time C++)

Todo

Download and install the Arduino IDE to program your Arduino Uno.

Download Link: https://downloads.arduino.cc/arduino-1.8.19-windows.zip

Version: 1.8.X

Todo

Check if VS Code automatically detected the installed Arduino IDE.

If in case it doesn’t happen, follow the steps below:

  • Open Extensions from Activity Bar. Search Arduino extension.

  • Click on small gear ⚙ (manage menu) next to it. It will open a new menu.

  • Click on Extension Settings. New tab will open.

  • Scroll down and find Arduino Path

  • Enter the complete installation address of your Arduino IDE. C:Program Files...

Hint

More information about the extension can be found in the Visual Studio Code Basics

Todo

Check out the Arduino examples provided with the libraries on the Side Bar. Open and test the Blink example.

Hint

Open Explorer and in the end a section named Arduino Examples can be expanded. Expand Built-in Examples -> 01. Basics -> Blink. A new window with the example will open.

../../_images/vs_code_arduino_ui.png

Fig. 2.5 VS Code Arduino UI

Todo

If you have not yet worked with the Arduino IDE before, follow this course on Arduino Basics

2.3. Version control using Git and GitLab

A version control is a kind of system which allows you to keep track of the changes that have been made to a code over a duration of time. This means that you can, at any given point in time, revert back to the older versions of the code you are working on.

Git is a popular VC software. Git works on Distributed Version Control Systems. This system provides everyone the copy of all files and allows user to edit them locally. The user can then work on the files locally and then upload the files to the server. The advantage of DVCS is that, if a server crashes, a local user can upload the files and make it running as they have a complete copy of the server data.

../../_images/git_distributed_model.png

Fig. 2.6 Distributed Version Control System. (ref: Git Book V2)

In this course, Git will be used as part of Visual Studio Code.

Todo

Download and install Git on your device

Download Link: https://git-scm.com/downloads

Todo

If you have not yet worked with Git before, please follow this course on Introduction to Version Control with Git

GitLab is a DevOps tool used for hosting Git repositories. It allows collaborative team work to develop softwares. The difference between Git and GitLab or other platforms (Bitbucket, GitHub) is that these platforms allow users to upload their git projects online. This makes collaborative team work easy. As for git, you can even work with git on a local computer without the need of a hosting platform. The local git project will stay for your use only and would not be shared directly with your teammates.

We will be using GitLab for this course as our university hosts a server of it, thus making it easy for us to use the platform. To use the University’s GitLab server, use the following link: https://git.fh-aachen.de/

You can check the access by logging on the following website using your FH-Kennung (FH identifier) (AB1234S) and password.

Todo

Create a profile for the FH-Aachen GitLab account and confirm that you have access to the GitLab server of your university.

Todo

Add your GitLab account to Visual Studio Code. You can follow the steps outlined in Visual Studio Code Basics

Todo

Create a new repository for your project. Share the repository with your teammates with proper access rights.

Todo

Create a new branch apart from Main (Master) branch. Work in the new branch only. When you are sure about your work , merge the changes from the new branch to Main (Master) branch.

2.4. Node-RED

Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click. (ref: Node-RED)

Todo

Download node-RED for your device and follow the Quick Start introduction: https://nodered.org/docs/getting-started/windows

Palettes is the menu on the left side. It contains all the available nodes that be used for designing a flow. The nodes are sorted with their use and the tree structure can be expanded and collapsed as per requirements.

External libraries can be installed on node-red using Palette Manager. You can open Palette Manager from the top right menu in node-red.

Todo

If you have not yet worked with Node-RED before, follow this course on Node Red Basics

Todo

Please install the following palettes:

2.5. Everything ready?

Todo

Check if you have the following setup running on your PC:

  • Visual Studio Code ready.

  • Arduino IDE 1.8.X ready.

  • Arduino Extension can be used in VS Code.

  • Your GitLab account is accessible via VS Code.

  • You have a repository created on the GitLab website and it’s cloned on your PC using VS Code.

  • Node-RED is running on your device and you can access it via your web browser.