Install Git for Windows. Ensure that Git is included in your ‘PATH’ environment variable.
Upload Firmata to your Arduino
Connect the Arduino board with your PC using the USB cable.
Open Arduino software.
Go to Tools->Port and select your device.
Go to Tools->Board and click on the type of Arduino you have.
Go to File->Examples->Firmata and select StandardFirmata. This will open up a new window with the Firmata sketch.
Click the upload button to upload the sketch to the Arduino board. You should see a “Done uploading” message when the upload is complete.
Create a new Cylon (Universal Windows) project
Select the Basic Node.js Cylon Application (Universal Windows) template (shown below), enter a name for your project, then press OK.
Wait for the Cylon package and its dependencies to complete downloading. This will be indicated by the message below in the npm output window.
Right-click on the npm node in the Solution Explorer (shown below) and select Update npm Packages.
This step will run npm dedupe and update serialport (a Cylon dependency) with a version that works with Node.js UWP.
Connect your Arduino to your Raspberry Pi 2 or 3
Connect your Arduino and Raspberry Pi 2 or 3 with the USB cable. If your Raspberry Pi 2 or 3 is connected to a monitor,
you should see the device getting recognized as shown in the image below (the name of the device may be something like “Arduino Uno” instead of “USB Serial Device”):
Get the port name of the Arduino
Let’s get the device ID that is associated with your Arduino (we will need this later in the Cylon code). To do that replace the code in app.js with the code shown below.
Go to the Project menu and select ‘<Your project name> Properties’ (You could also right-click on the project node in solution explorer to access Properties).
Enter the IP Address in the Remote Machine text box. Since you’re building for Raspberry Pi 2 or 3, select ARM in the dropdown menu.
Press F5 (or select Debug | Start Debugging) to deploy and start the app. When the app runs, it will output the names of ports that are attached to your
Raspberry Pi (see image below). Make a note of the ID (value of ‘port.comName’ in the code above) for the Arduino since we’ll use it in the next step.
Deploy and start your Cylon app
Replace the code in app.js with the Cylon code shown below. Also replace the port value with the ID of your device.
Be sure to double the backslashes in the string. e.g. \\?\ should be \\\\?\\.
Attach the servo to the the arduino board using pin 3 (you can also change the pin number in app.js). In the setup shown below,
the signal wire is connected to pin 3 and the power source is the Raspberry Pi.
Press F5 (or select Debug | Start Debugging) to deploy and start the app. This step will also start rotating the motor on the servo.