/Windows-IoT-Samples

This is the official repo for samples targeting Windows IoT

Primary LanguageC++MIT LicenseMIT

██╗       ██╗ ██╗ ███╗  ██╗ ██████╗   █████╗  ██╗       ██╗  ██████╗      ██╗        ████████╗
██║  ██╗  ██║ ██║ ████╗ ██║ ██╔══██╗ ██╔══██╗ ██║  ██╗  ██║ ██╔════╝      ██║        ╚══██╔══╝
╚██╗████╗██╔╝ ██║ ██╔██╗██║ ██║  ██║ ██║  ██║ ╚██╗████╗██╔╝ ╚█████╗       ██║  █████╗   ██║
 ████╔═████║  ██║ ██║╚████║ ██║  ██║ ██║  ██║  ████╔═████║   ╚═══██╗      ██║ ██╔══██║  ██║
 ╚██╔╝ ╚██╔╝  ██║ ██║ ╚███║ ██████╔╝ ╚█████╔╝  ╚██╔╝ ╚██╔╝  ██████╔╝      ██║ ╚█████╔╝  ██║  
  ╚═╝   ╚═╝   ╚═╝ ╚═╝  ╚══╝ ╚═════╝   ╚════╝    ╚═╝   ╚═╝   ╚═════╝       ╚═╝  ╚════╝   ╚═╝

Windows Internet of Things (IoT) Samples

This repo contains samples that demonstrate usage patterns for Microsoft's Windows 10 IoT. These code samples were created with templates available in Visual Studio and are designed, but not limited to, run on devices using Windows IoT Enterprise.

Note: If you are unfamiliar with Git and GitHub, you can download the entire collection as a ZIP file, but be sure to unzip everything to access shared dependencies. For more info on working with the ZIP file, the samples collection, and GitHub, see Get the UWP samples from GitHub. For more samples, see the Samples portal on the Windows Dev Center.

Windows 10 IoT development

These samples require Visual Studio and the Windows Software Development Kit (SDK) for Windows 10.

Get a free copy of Visual Studio Community Edition with support for building Universal Windows Platform apps

Additionally, to stay on top of the latest updates to Windows and the development tools, become a Windows Insider by joining the Windows Insider Program.

Become a Windows Insider

Using the samples

The easiest way to use these samples without using Git is to download the zip file containing the current version (using the following link or by clicking the "Download ZIP" button on the repo page). You can then unzip the entire archive and use the samples in Visual Studio.

Download the samples ZIP

Notes:

  • Before you unzip the archive, right-click it, select Properties, and then select Unblock.
  • Be sure to unzip the entire archive, and not just individual samples. The samples all depend on the SharedContent folder in the archive.
  • In Visual Studio, the platform target defaults to ARM, so be sure to change that to x64 or x86 if you want to test on a non-ARM device.

The samples use Linked files in Visual Studio to reduce duplication of common files, including sample template files and image assets. These common files are stored in the SharedContent folder at the root of the repository and are referred to in the project files using links.

Reminder: If you unzip individual samples, they will not build due to references to other portions of the ZIP file that were not unzipped. You must unzip the entire archive if you intend to build the samples.

For more info about the programming models, platforms, languages, and APIs demonstrated in these samples, please refer to the guidance, tutorials, and reference topics provided in the Windows 10 documentation available in the Windows Developer Center. These samples are provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for Windows.

Contributing

These samples are direct from the feature teams and we welcome your input on issues and suggestions for new samples. If you would like to see new coverage or have feedback, please consider contributing. You can edit the existing content, add new content, or simply create new issues. We’ll take a look at your suggestions and will work together to incorporate them into the docs.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

Note:

  • When contributing, make sure you are contributing from the develop branch and not the master branch. Your contribution will not be accepted if your PR is coming from the master branch.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

See also

For additional Windows samples, see:

Samples by category

Azure IoT Edge

Name Description
interop-textmsg-consoleapp Basic interop sample demonstrating text messaging between a Windows console app and an Edge module.
interop-customvision-textmsg-uwpapp

Two more advanced interop samples which demonstrate bidirectional communication between a Windows application and an Edge module.

  • Text messaging between a UWP application and an Edge module.
  • A 'Custom vision' machine learning interop sample with a fruit classifier which uses a Windows UWP app to send camera frames to an Edge module for identification.

Windows 10 IoT Enterprise

Name Description
Accelerometer Sample app that reads data over either I2C or SPI from an attached ADXL345 accelerometer
AppServiceBlinky Two part sample. 1. Create a simple Blinky app service and connect a LED to your Windows IoT Enterprise device (Up-Board). 2. Create a simple app service client that blinks the LED
AppServiceSharedNotepad This app creates a simple notepad app service, and two simple app service clients. One app will write to the notepad service and the other one reads from the notepad service.
CustomDeviceAccessor This sample shows how to access devices from UWP applications using familiar win32 APIs like CreateFile(), ReadFile(), WriteFile(), and DeviceIOControl().
DMMockPortal This sample shows what an operator's flow might look like when it comes to updating devices in bulk or individually.
DeviceIOContoller This sample shows how to access devices from UWP applications using familiar win32 APIs like CreateFile(), ReadFile(), WriteFile(), and DeviceIoControl().
DualOperator This sample demonstrates Dual Operator demonstrates routing input from 2 physical keyboards to specific applications.
ExternalProcessLauncher We'll learn how to launch an external process (exe) from a Universal Windows Platform (UWP) app using Windows.System.ProcessLauncher API.
FlowVolume This sample show how to launch an external process (exe) from a Universal Windows Platform (UWP) app using Windows.System.ProcessLauncher API.
ForegroundAppWithBackgroundApp This sample will showcase how to create a foreground application with a background application.
GPIOKmdfDemo This sample will demonstrate how to deploy a GPIO Kernel driver to a Windows 10 IoT Device.
GPIOOneWire This sample shows how to read a temperature and humidity sensor from a Universal Windows Application.
HIDInjector This sample will allow you to deploy a driver to perform low level injection of touch, keyboard and mouse events.
Hello Blinky This sample is a simple blinking LED app.
HelloBlinkyBackground This sample showcases how to set up and use a background service.
I2CCompass This sample uses I2C on Windows IoT Enterprise to communicate with an magnetometer device.
I2CPortExpander This sample app uses the port expander to read the status of a tactile switch and control an LED.
IoTEnterpriseDefault This sample app provides an overview of the various features that can be enabled in Windows 10 IoT Enterprise.
IoTHubClients This sample demonstrates how to connect to IoT Hub, send telemetry, and monitor and respond to device twin state changes.
MemoryStatus This sample is intended to show how to create a console application that can be used to query the memory usage on your Windows 10 IoT Enterprise device.
NTServiceRpc This sample demonstrates the use of a NT service with an UWP app.
Potentiometer This sample shows how to connect a rotary potentiometer and LED to a Windows IoT Enterprise compatible board.
PushButtton This sample shows how to use a push button to control an LED.
RFIDForIoT This sample demonstrates how to read an RFID tag and beep the buzzer when the card scans.
RGBLED This sample demonstrates how a tri-color LED will blink and cycle through red, blue and green.
SPIDisplay This sample interfaces a SPI based OLED display to a Windows 10 IoT Enterprise device.
SerialNumber This sample demonstrates how to get the device serial number.
SerialUART This sample creates an app that allows communication between a PC and an IoT device over a serial interface.
ShellLauncher This is a UWP app sample for Shell Launcher V2, see how to configure UWP app for Shell Launcher V2 in the samples.
SpeechTranslator This sample will translate speech to different languages.
TempForceSensor This sample showcases how to use a temperature and force sensor.
VideoCaptureSample This sample initializes a video capture device, record video to a file, preview video feed, and playback the recorded video.
VirtualMicrophoneArrayDriver This sample illustrates how to construct a virtual microphone array at runtime using monoaural audio devices present on the system.
WebcamApp This sample will initialize a webcam, take pictures, and record video and audio.
WifiConnector This sample will find and connect to WiFi networks using a Universal Windows Platform (UWP) app that makes use of the Windows.Devices.WiFi.WiFiAdapter API.

Bus Tools

Name Description
GPIOTestTool Utility to manipulate GPIO pins from the command line. Demonstrates how to use the GPIO WinRT APIs from standard C++ with WRL.
I2CTestTool Utility to read and write I2C devices from the command line. Shows how to use C++/CX in console applications.
MinComm (UART) Demonstrates how to use UART.
PWMTestTool Utility to read and write PWM devices from the command line. Shows how to use C++/CX in console applications.
SPITestTool Utility to read and write SPI devices from the command line.