Skip to content

Latest commit

 

History

History
99 lines (64 loc) · 3 KB

ubuntu-PT6500-c.md

File metadata and controls

99 lines (64 loc) · 3 KB
platform device language
Ubuntu 15.04
PT6500
c

Run a simple C sample on PT6500 device running Ubuntu


Table of Contents

Introduction

About this document

This document describes how to connect PT6500 device running Ubuntu with Azure IoT SDK. 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: Prepare your Device

  • Install Ubuntu Linux.

Step 3: Build and Run the sample

3.1 Build SDK and sample

  • Open a PuTTY session and connect to the device.

  • Install the prerequisite packages for the Microsoft Azure IoT Device SDK for C by issuing the following commands from the command line on your board:

    sudo apt-get update
    
    sudo apt-get install -y curl libcurl4-openssl-dev uuid-dev uuid g++ make cmake git unzip libssl-dev
    
  • Download the Microsoft Azure IoT Device SDK for C to the board by issuing the following command on the board::

    git clone --recursive https://github.com/Azure/azure-iot-sdks.git
    
  • Edit the following file using any text editor of your choice:

    azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c
    
  • Find the following place holder for IoT connection string:

    static const char* connectionString = "[device connection string]";
    
  • Replace the above placeholder with device connection string you obtained in Step 1 and save the changes.

  • Build the SDK using following command.

    sudo ./azure-iot-sdks/c/build_all/linux/build.sh
    

3.2 Send Device Events to IoT Hub:

  • Run the sample by issuing following command:

    azure-iot-sdks/c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http
    
  • See Manage IoT Hub to learn how to observe the messages IoT Hub receives from the application.

3.3 Receive messages from IoT Hub

  • See Manage IoT Hub to learn how to send cloud-to-device messages to the application.

Tips

  • If you just want to build the serializer samples, run the following commands:

    cd ./c/serializer/build/linux
    make -f makefile.linux all