There are three ways to add the Windows Remote Arduino library to your solution, in order from easiest to most difficult.
Of these options, installing the NuGet package is by far the easiest.
NuGet is a quick and easy way to automatically install the packages and setup dependencies. Within Visual Studio simply open the Package Management Console and select the target project, then issue the following command:
Install-Package Windows-Remote-Arduino
- File -> New Project
-
Select your language of choice. Windows Remote Arduino is a WinRT component, meaning it is compatable with C++, C#, or JavaScript.
-
You'll see I have chosen C# by expanding the "Visual C#" menu. Select the "Windows" option and choose "Blank App (Windows Universal)" or "Blank App (Windows 8.1 Universal)" if you are building for Windows 8.1.
-
Clone the Windows Remote Arduino GitHub repository.
-
Right-click on your solution in the Solution Explorer and select Add -> Existing Project
- Navigate to your local copy of the repository. You'll see here that I've cloned it to C:\git\remote-wiring, but you can choose a different directory. Then, open the appropriate solution folder for your build environment (either Windows 10 or Windows 8.1).
- Let's start with the Serial project (Microsoft.Maker.Serial). Open this directory.
- Select the .vcxproj file. (If you are targeting Windows 8.1, you will first have to choose between Windows and Windows Phone platform directories. You do not have to do this for Windows 10, as it is Universal to all platforms!)
- Right-click on "References" in your project. Select Add Reference
- Under the "Projects" tab, select all three of the Microsoft.Maker projects
- Rebuild your solution by selecting Build -> Rebuild All
- Verify you have added the necessary Device Capabilities to your project manifest!
You can now use the three projects directly in your source code! You will notice I have constructed a BluetoothSerial object and attached it to my RemoteDevice object, so I have included the two appropriate namespaces at the top of my .cs file.
Each Windows project will contain a manifest file that must be configured to allow certain permissions, such as Bluetooth and USB connectivity. Fortunately, it is fairly easy to configure these.
You will need to open the package.appxmanifest file of your project by right-clicking and selecting the "View Code" option. Then find the tag and paste one or both of the following tag blocks as a child node.
For Windows 8.1, you will need to add the following namespace to the top of the XML file, inside the <Package>
tag.
xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest"
You will need to add one of the following XML blocks to your manifest file, inside the tag, in order to invoke the Bluetooth/USB capabilities of a WinRT application, depending on which OS version you are targetting.
<DeviceCapability Name="bluetooth.rfcomm">
<Device Id="any">
<Function Type="name:serialPort"/>
</Device>
</DeviceCapability>
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="name:serialPort"/>
</m2:Device>
</m2:DeviceCapability>
You will need to add one of the following XML blocks to your manifest file, inside the tag, in order to invoke the network socket capabilities of a WinRT application.
<Capability Name="privateNetworkClientServer"/>
<Capability Name="internetClientServer"/>
You will need to add one of the following XML blocks to your manifest file in order to invoke the USB capabilities of a WinRT application, depending on which OS version you are targetting.
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort"/>
</Device>
</DeviceCapability>
Unfortunately, this library does not support USB on Windows 8.1.