Earlier this challenge, I have been setting up the development environment using Visual Studio and in one of those posts, I did mention on how to configure Visual Studio to develop Linux applications using VisualGDB. SysProgs has a very good tutorial here. This is very much useful if writing apps using C/C++, as the debugging experience in Visual Studio is exceptional. However, my initial plan to use C/C++ for the Linux application on the BeagleBone Black has changed and have been using node.js for application development.
By default, node.js is not a one of the available JavaScript templates in Visual Studio. This blog post will walk you through on how to get node.js development on Visual Studio for the BeagleBone Black. To do so, just follow the steps below.
- Before starting, ensure that the latest updates on Visual Studio are installed. You can get the latest update here.
- Next, install WebEssentials extension, download it from here.
- Then, install node.js from their site.
- Lastly, install NTVS (node.js Tools for Visual Studio) as the main component to transform Visual Studio into node.js development environment.
Now, from the New Project window, you can select Node.js application template.
Run and start debugging the node.js application as you would any other VS application.
Installing node.js Packages
Since MQTT is vital in this design challenge, we can install node.js modules through the built-in npm (node.js package manager). To get the MQTT module, expand the node.js project, then right-click on npm, which will then bring up the npm install window (see below).
Just type the module name in the search bar and click on Install Package to add the specific node.js module in the project.
Transferring Files to Beagle Bone Black
Once you have done enough coding and debugging and would like to do testing on the target machine, the Beagle Bone Black in this case, simply copy the files from the Visual Studio project directory to BeagleBoneBlack's cloud9 directory ( /var/lib/cloud9 ) using FileZilla or similar tool.
There we have it, node.js development using Visual Studio which targets the Beagle Bone Black.