Additional details are provided below this code section – any line or section marked with //(#) will be further analyzed. With the NuGet installed, we transfer the code below to a fresh Visual Studio solution.
You can also search for and install the NuGet by selecting “Manage NuGet Packages for Solution” under the NuGet Package Manager menu and searching for “Remote Arduino” on the “Browse” tab. Enter Install-Package Windows-Remote-Arduino.Open the Package Manager Console by clicking the “Tools” menu.With setup complete, we can start a new Universal Windows Application project in Visual Studio and import the Windows Remote Arduino NuGet using the NuGet Package Manager.
A complete walkthrough for a similar project can be found at the Hackster post here. You can also check out the video below for a glance at what the sample enables:įor more information on setup, refer to the Get Started page and this guide on using Bluetooth with Windows Remote Arduino. This section follows a simple sample that blinks an LED remotely using Windows Remote Arduino. There is a guide for these advanced behaviors on GitHub. SysEx commands allow developers to write complex or custom code in the StandardFirmata sketch file that can be executed with Remote Arduino. A developer can set the modes or states of pins, read the values of digital or analog pins, initiate I2C communications to other devices, and even drive servos just by using this single class.Īdvanced behaviors, such as SPI transactions, are also possible through SysEx commands. After invoking begin() on the Stream object, all remaining API calls are made through the RemoteDevice instance. A RemoteDevice must be constructed with one of the IStream implementations ( UsbSerial, BluetoothSerial, NetworkSerial, or DfRobotBleSerial) contained within the Stream layer. On the very top is the surface API, which abstracts away all protocol messages and allows for remote control of the Arduino.įor all basic use cases, the RemoteDevice class contained within the RemoteWiring layer is the main layer that the developer will interact with. Above the communication layer is the protocol layer, which decodes the raw incoming data into meaningful messages. Physical communication, as the bottom layer, is necessary to allow raw data to be exchanged between Windows and the Arduino device. With the above design decisions, the Windows Remote Arduino was built like a three-layer cake. The Firmata library for Arduino is even included in the Arduino IDE by default. Firmata is a widely accepted open-source protocol that has been implemented in many languages, including Arduino Wiring.
However, with a bit of reorganization, it is possible to use the logic and commands of an Arduino sketch in a Windows 10 UWP app using Windows Remote Arduino.Īfter designing the API, a protocol was needed that would facilitate communication between Windows 10 and an Arduino – Firmata was the obvious choice. There are changes, of course, as the WinRT framework is fundamentally very different from the basic Wiring language used in Arduino sketches. Our API was crafted to mirror the familiar Arduino Wiring API as much as possible. Commands like pinMode and digitalWrite are so familiar to Arduino developers that rather than reinvent them, we chose to adhere to what is already familiar. Let’s discuss the design of the Windows Remote Arduino API.
Full hardware and software setup instructions can be found here.
In this section we explain the thought process behind the design of the library, take a close look at the library’s structure, and review a simple code sample. Now that we’ve seen a bit of what Windows Remote Arduino can do, let’s explore how the technology works.