Skip to content

Latest commit

 

History

History
81 lines (53 loc) · 2.7 KB

windows-desktop-c.md

File metadata and controls

81 lines (53 loc) · 2.7 KB
platform device language
windows
desktop
c

Run a simple C sample on Windows


Table of Contents

Introduction

About this document

This document describes how to build and run sample applications on the Windows platform. This multi-step process includes:

  • Configuring Azure IoT Hub
  • Registering your IoT device
  • Build and deploy Azure IoT SDK on device

Step 1: Prerequisites

You should have the following items ready before beginning the process:

Step 2: Build and Run the sample

  1. Start a new instance of Visual Studio 2015. Open the azure_iot_sdks.sln solution in the cmake folder in your home directory.

  2. In Visual Studio, in Solution Explorer, navigate to project based on your choice of protocol:

    For AMQP protocol:

    Navigate to simplesample_amqp project and open the simplesample_amqp.c file.

    For HTTP protocol:

    Navigate to simplesample_http project and open the simplesample_http.c file.

    For MQTT protocol:

    Navigate to simplesample_mqtt project and open the simplesample_mqtt.c file.

    cfile_edit

  3. Locate the following code in the file:

    static const char* connectionString = "[device connection string]";
    
  4. Replace "[device connection string]" with the device connection string you noted earlier and save the changes:

    static const char* connectionString = "HostName=..."
    
  5. In Solution Explorer, right-click the project updated, click Debug, and then click Start new instance to build and run the sample.

    project_debug

  6. The console displays messages as the application sends device-to-cloud messages to IoT Hub.

  7. See Manage IoT Hub to learn how to observe the messages IoT Hub receives from the application and how to send cloud-to-device messages to the application.