- Joined
- Jun 27, 2006
- Messages
- 23,048
- Thread Author
- #1
Developers targeting Windows 10 IoT Core can use a programming language of their choice. Today, this includes C#, C++, Visual Basic, JavaScript, Link Removed and Node.js, but we’re not stopping there. Arduino Wiring is the latest addition to IoT Core.
Arduino is one of the most popular platforms among makers. Its community has produced a large number of libraries to interface with peripherals such as LED displays, sensors, RFID readers and breakout boards. One of the main drivers for Arduino’s adoption is its simplicity. With Windows 10 IoT Core, you can now create or port Arduino Wiring sketches that will run on supported IoT Core devices, including Raspberry Pi 2, 3 and Minnowboard Max.
Creating your first Arduino Wiring sketch for IoT Core
You can find the detailed steps for creating Arduino wiring sketches in the Arduino Wiring Project Guide. In addition, here is a quick summary:
Link Removed
Link Removed
On an IoT Core device, an Arduino Wiring sketch runs as a Link Removed (headless); i.e. there is no UI visible on an attached monitor. This is similar to running a sketch on an Arduino device such as the Arduino Uno for example. However, you can still debug the sketch as you would any other app under Visual Studio by inserting breakpoints and/or stepping through the code. Additionally, to enable verbose output logging, Serial.print() and Link Removed have been updated to send their output to Visual Studio’s debug pane when the sketch is running under the debugger (the output will also be sent to the serial pins). The Log() function can be used to output to debug as well. Check the Link Removed for more details on using Serial.print*() on IoT Core devices.
Porting an Arduino wiring sketch or library to Windows 10 IoT Core
For many Arduino Wiring sketches, simply copying the source code from the existing one to a new Arduino Wiring project in Visual Studio editor and replacing the pin numbers with the ones on your device would suffice.
However, while we have tried to make our implementation as close as possible to other Arduino-based devices, in some cases, a few modifications need to be made to your sketch to make it compatible with the Windows IoT Core OS, the C++ compiler or the board the sketch is running on. The Link Removed covers many of those modifications needed and solutions to problems you may face while porting your sketch.
To use an existing Arduino library, you simply need to copy and add the header (.h) and source file (.cpp) for the library to your project, then reference the header file. Again, most libraries should work with no or very few modifications. However, if you face any issues, please check the Arduino Wiring Porting Guide.
Writing Windows 10 IoT Core specific code
For your scenario, you may want to write code parts that target Windows 10 IoT Core only, but at the same time maintain compatibility with other devices. For that, you can use the _WIN_IOT macro; e.g.:
#ifdef _WIN_IOT
// Windows IoT code only
#else
// Other platforms code
#endif
Arduino Wiring and the Universal Windows Platform (UWP)
Arduino sketches runtime behavior on IoT Core devices is similar to other Arduino devices, with every function implemented to work the same way when interacting with the various controllers. However, Arduino Wiring sketches are also Windows UWP apps and thus can be extended to call any UWP APIs such as networking, storage, Bluetooth, media, security and others; for example, you can communicate with Bluetooth devices, Link Removed network or even create a OneNote app using Arduino Wiring.
Additionally, you can wrap your sketch inside a WinRT library and use it in any UWP app, including UI apps. Link Removed guide details the steps needed to create Arduino Wiring based libraries.
Additional Resources:
Here are additional resources to assist with creating/porting Arduino Wiring apps running on Windows 10 IoT Core:
Also, check out these Arduino Wiring samples:
Link Removed Weather Station Link Removed
RGB Pixel Link Removed Link Removed
Finally, please add your questions/comments below or send your feature requests to the Lightning repository on GitHub.
Get started with Visual Studio.
Continue reading...
Arduino is one of the most popular platforms among makers. Its community has produced a large number of libraries to interface with peripherals such as LED displays, sensors, RFID readers and breakout boards. One of the main drivers for Arduino’s adoption is its simplicity. With Windows 10 IoT Core, you can now create or port Arduino Wiring sketches that will run on supported IoT Core devices, including Raspberry Pi 2, 3 and Minnowboard Max.
Creating your first Arduino Wiring sketch for IoT Core
You can find the detailed steps for creating Arduino wiring sketches in the Arduino Wiring Project Guide. In addition, here is a quick summary:
- Link Removed with Windows 10 IoT Core.
- Link Removed with Windows 10 and Visual Studio 2015.
- Download and install the Link Removed.
- Start Visual Studio and create a new Arduino Wiring project. The project template can be found under Templates | Visual C++ | Windows | Windows IoT Core.
Link Removed
- Upon project creation, a sketch file with the same name and the extension ‘.ino’ will be created and opened by default. The sketch includes a template for Arduino Wiring using a classic hello world LED blinking code. More details about the Arduino Wiring template and required device setup can be found at the Link Removed.
Link Removed
- Before deploying, make sure to change the driver on the target device to DMAP. For more details, follow the instructions in the Link Removed.
- Finally, select your remote machine and press F5 to build and deploy your app to your device. Go back to the Link Removed for additional guidance.
On an IoT Core device, an Arduino Wiring sketch runs as a Link Removed (headless); i.e. there is no UI visible on an attached monitor. This is similar to running a sketch on an Arduino device such as the Arduino Uno for example. However, you can still debug the sketch as you would any other app under Visual Studio by inserting breakpoints and/or stepping through the code. Additionally, to enable verbose output logging, Serial.print() and Link Removed have been updated to send their output to Visual Studio’s debug pane when the sketch is running under the debugger (the output will also be sent to the serial pins). The Log() function can be used to output to debug as well. Check the Link Removed for more details on using Serial.print*() on IoT Core devices.
Porting an Arduino wiring sketch or library to Windows 10 IoT Core
For many Arduino Wiring sketches, simply copying the source code from the existing one to a new Arduino Wiring project in Visual Studio editor and replacing the pin numbers with the ones on your device would suffice.
However, while we have tried to make our implementation as close as possible to other Arduino-based devices, in some cases, a few modifications need to be made to your sketch to make it compatible with the Windows IoT Core OS, the C++ compiler or the board the sketch is running on. The Link Removed covers many of those modifications needed and solutions to problems you may face while porting your sketch.
To use an existing Arduino library, you simply need to copy and add the header (.h) and source file (.cpp) for the library to your project, then reference the header file. Again, most libraries should work with no or very few modifications. However, if you face any issues, please check the Arduino Wiring Porting Guide.
Writing Windows 10 IoT Core specific code
For your scenario, you may want to write code parts that target Windows 10 IoT Core only, but at the same time maintain compatibility with other devices. For that, you can use the _WIN_IOT macro; e.g.:
#ifdef _WIN_IOT
// Windows IoT code only
#else
// Other platforms code
#endif
Arduino Wiring and the Universal Windows Platform (UWP)
Arduino sketches runtime behavior on IoT Core devices is similar to other Arduino devices, with every function implemented to work the same way when interacting with the various controllers. However, Arduino Wiring sketches are also Windows UWP apps and thus can be extended to call any UWP APIs such as networking, storage, Bluetooth, media, security and others; for example, you can communicate with Bluetooth devices, Link Removed network or even create a OneNote app using Arduino Wiring.
Additionally, you can wrap your sketch inside a WinRT library and use it in any UWP app, including UI apps. Link Removed guide details the steps needed to create Arduino Wiring based libraries.
Additional Resources:
Here are additional resources to assist with creating/porting Arduino Wiring apps running on Windows 10 IoT Core:
- Arduino Wiring Project Guide
- Link Removed
- Link Removed
- Link Removed YouTube video
Also, check out these Arduino Wiring samples:
Link Removed Weather Station Link Removed
RGB Pixel Link Removed Link Removed
Finally, please add your questions/comments below or send your feature requests to the Lightning repository on GitHub.
Get started with Visual Studio.
Continue reading...