<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Dave Glover</title>
    <description>The latest articles on Forem by Dave Glover (@gloveboxes).</description>
    <link>https://forem.com/gloveboxes</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F149402%2Fa777894f-60c2-4974-8af2-64b3a5974cb1.jpeg</url>
      <title>Forem: Dave Glover</title>
      <link>https://forem.com/gloveboxes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/gloveboxes"/>
    <language>en</language>
    <item>
      <title>Build an Air Pollution Monitor with a Raspberry Pi, a Particulate Matter sensor and IoT Central</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Fri, 24 Jul 2020 01:26:20 +0000</pubDate>
      <link>https://forem.com/azure/build-an-air-pollution-monitor-with-a-raspberry-pi-a-particulate-matter-sensor-and-iot-central-7kd</link>
      <guid>https://forem.com/azure/build-an-air-pollution-monitor-with-a-raspberry-pi-a-particulate-matter-sensor-and-iot-central-7kd</guid>
      <description>&lt;h1&gt;
  
  
  Build an Air Pollution Monitor with a Raspberry Pi, a Particulate Matter sensor and IoT Central
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Born of necessity, this project tracked the air quality over Sydney during the height of the Australian bush fires. I wanted to gauge when it was safe to go outside, or when it was better to close up the apartment and stay in for the day.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sydney, Dec 2019&lt;/th&gt;
&lt;th&gt;Particulate matter readings&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor%2Fmaster%2Fzdocs%2Fresources%2Fsydney-height-of-bush-fires.jpg"&gt;&lt;/td&gt;
&lt;td&gt;Readings for PM 2.5 and PM 10 approx 1000. Healthy levels should be between 0 ~ 10. &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor%2Fmaster%2Fzdocs%2Fresources%2Fpm-readings-dec-10-2019.png"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is Sydney on a clear day, the photo was taken in May 2020, alas, during the COVID-19 pandemic lock down. On the upside, there is close to zero air pollution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor%2Fmaster%2Fzdocs%2Fresources%2Fsydney-height-of-pandemic.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor%2Fmaster%2Fzdocs%2Fresources%2Fsydney-height-of-pandemic.jpg"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  #JulyOT
&lt;/h2&gt;

&lt;p&gt;This is part of the #JulyOT &lt;a href="http://aka.ms/julyot" rel="noopener noreferrer"&gt;IoT Tech Community&lt;/a&gt; series, a collection of blog posts, hands-on-labs, and videos designed to demonstrate and teach developers how to build projects with Azure Internet of Things (IoT) services. Please also follow &lt;a href="https://twitter.com/hashtag/JulyOT" rel="noopener noreferrer"&gt;#JulyOT&lt;/a&gt; on Twitter.&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this hands-on lab, you will learn how to create and debug a Python application on a Raspberry Pi with &lt;a href="https://code.visualstudio.com/?WT.mc_id=julyot-aqm-dglover" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt; and the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh&amp;amp;WT.mc_id=julyot-aqm-dglover" rel="noopener noreferrer"&gt;Remote SSH&lt;/a&gt; extension. The app requires the &lt;a href="https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-plus" rel="noopener noreferrer"&gt;Pimoroni Enviro+ pHAT&lt;/a&gt;, and reads data from the PMS5003 particulate matter (PM) and BME280 sensors and streams the data to &lt;a href="https://azure.microsoft.com/services/iot-central/?WT.mc_id=julyot-aqm-dglover" rel="noopener noreferrer"&gt;Azure IoT Central&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Parts required
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Raspberry Pi 2 or better, SD Card, and Raspberry Pi power supply&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-plus" rel="noopener noreferrer"&gt;Pimoroni Enviro+ pHAT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PMS5003 Particulate Matter Sensor with Cable available from &lt;a href="https://shop.pimoroni.com/products/pms5003-particulate-matter-sensor-with-cable" rel="noopener noreferrer"&gt;Pimoroni&lt;/a&gt; and eBay.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This lab depends on Visual Studio Code and Remote SSH development. Remote SSH development is supported on Raspberry Pis built on ARMv7 chips or better. The Raspberry Pi Zero is built on ARMv6 architecture. The Raspberry Pi Zero is capable of running the solution, but it does not support Remote SSH development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor%2Fmaster%2Fzdocs%2Fresources%2Fazure-iot-central-air-quality-monitor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor%2Fmaster%2Fzdocs%2Fresources%2Fazure-iot-central-air-quality-monitor.png"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's get started
&lt;/h2&gt;

&lt;p&gt;Head to &lt;a href="https://gloveboxes.github.io/Raspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor/" rel="noopener noreferrer"&gt;Raspberry Pi Air Pollution Monitor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are five modules covering the following topic&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Module 1: Create an Azure IoT Central application&lt;/li&gt;
&lt;li&gt;Module 2: Set up your Raspberry Pi&lt;/li&gt;
&lt;li&gt;Module 3: Set up your development environment&lt;/li&gt;
&lt;li&gt;Module 4: Run the solution&lt;/li&gt;
&lt;li&gt;Module 5: Dockerize the Air Quality Monitor solution&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source code
&lt;/h2&gt;

&lt;p&gt;All source code available for the &lt;a href="https://gloveboxes.github.io/Raspberry-Pi-Python-Environment-Monitor-with-the-Pimoroni-Enviro-Air-Quality-PMS5003-Sensor/" rel="noopener noreferrer"&gt;Raspberry Pi Air Pollution monitor&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowledgements
&lt;/h2&gt;

&lt;p&gt;This tutorial builds on the &lt;a href="https://github.com/Azure/azure-iot-sdk-python/tree/master/azure-iot-device/samples" rel="noopener noreferrer"&gt;Azure IoT Python SDK 2&lt;/a&gt; samples.&lt;/p&gt;




&lt;p&gt;Have fun and stay safe and be sure to follow us on &lt;a href="https://twitter.com/hashtag/JulyOT?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#JulyOT&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>julyot</category>
      <category>raspberrypi</category>
      <category>iot</category>
      <category>azure</category>
    </item>
    <item>
      <title>Build Raspberry Pi .NET Core IoT Applications running on Raspberry Pi OS or Ubuntu 20.04 </title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Thu, 23 Jul 2020 04:38:29 +0000</pubDate>
      <link>https://forem.com/azure/build-raspberry-pi-net-core-c-iot-applications-on-raspberry-pi-os-or-ubuntu-20-04-14bk</link>
      <guid>https://forem.com/azure/build-raspberry-pi-net-core-c-iot-applications-on-raspberry-pi-os-or-ubuntu-20-04-14bk</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fbanner.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fbanner.png" alt=".net core loves single board computers"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Follow me on &lt;a href="https://twitter.com/dglover" rel="noopener noreferrer"&gt;Twitter @dglover&lt;/a&gt; &lt;/p&gt;




&lt;h2&gt;
  
  
  #JulyOT
&lt;/h2&gt;

&lt;p&gt;This is part of the #JulyOT &lt;a href="http://aka.ms/julyot" rel="noopener noreferrer"&gt;IoT Tech Community&lt;/a&gt; series, a collection of blog posts, hands-on-labs, and videos designed to demonstrate and teach developers how to build projects with Azure Internet of Things (IoT) services. Please also follow &lt;a href="https://twitter.com/hashtag/JulyOT" rel="noopener noreferrer"&gt;#JulyOT&lt;/a&gt; on Twitter.&lt;/p&gt;




&lt;h2&gt;
  
  
  Operating Systems and ARM architectures supported
&lt;/h2&gt;

&lt;p&gt;This tutorial has been tested with .NET Core applications running on &lt;strong&gt;Raspberry Pi OS&lt;/strong&gt; and &lt;strong&gt;Ubuntu 20.04&lt;/strong&gt; (including Ubuntu Mate 20.04) for both 32bit (ARM32) and 64bit (ARM64). The projects also include build tasks for Debug and Release configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;

&lt;p&gt;The source and the samples for this tutorial can be found &lt;a href="https://gloveboxes.github.io/Create-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Examples
&lt;/h3&gt;

&lt;p&gt;The examples are found in the samples director of this repo and cover the following .NET Core scenarios.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Simple hello world&lt;/strong&gt;: dotnet.core.iot.csharp&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure IoT Hub&lt;/strong&gt;: dotnet.core.iot.csharp.iothub&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.NET Core Web API&lt;/strong&gt;: dotnet.core.iot.csharp.webapi&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.NET Core Web App&lt;/strong&gt;: dotnet.core.iot.csharp.webapp&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure IoT Hub or IoT Central with DPS (Device Provisioning Service)&lt;/strong&gt;: dotnet.core.iot.csharp.dps.iot&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure IoT device twins&lt;/strong&gt;: dotnet.core.iot.csharp.dps.iot.device-twins&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure IoT Hub device twins, and Pi Sense HAT&lt;/strong&gt;: dotnet.core.iot.csharp.dps.iot.device-twins.sense.hat&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple Pi Sense HAT Sample&lt;/strong&gt;: dotnet.core.iot.csharp.sense.hat
9: &lt;strong&gt;F# and .NET Core&lt;/strong&gt;: dotnet.core.iot.fsharp&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Tips and Tricks for setting up Ubuntu 20.04 on a Raspberry Pi
&lt;/h2&gt;

&lt;p&gt;Check out the following &lt;a href="https://github.com/gloveboxes/Create-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications/blob/master/TIPS_AND_TRICKS.md" rel="noopener noreferrer"&gt;Raspberry Pi Tips and Tricks&lt;/a&gt; to boot Ubuntu from USB3 SSD, how to overclock, enable WiFi, and support for the Raspberry Pi Sense HAT.&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The .NET Core IoT Library connects your applications to hardware. In this tutorial you will learn how to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Develop a C# .NET Core IoT application from your Linux, macOS or Windows 10 computer,&lt;/li&gt;
&lt;li&gt;Streamline the develop, deploy, and debug process using Visual Studio Code,&lt;/li&gt;
&lt;li&gt;Use the &lt;a href="https://dotnet.microsoft.com/apps/iot?WT.mc_id=julyot-dnc-dglover" rel="noopener noreferrer"&gt;.NET Core IoT&lt;/a&gt; library to read the CPU temperature. The CPU temperature will be used to represent the room temperature in this lab scenario,&lt;/li&gt;
&lt;li&gt;Stream temperature telemetry to &lt;a href="https://docs.microsoft.com/en-us/azure/iot-hub/about-iot-hub?WT.mc_id=julyot-dnc-dglover" rel="noopener noreferrer"&gt;Azure IoT Hub&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;Control a remote HVAC system.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Raspberry Pi Hardware
&lt;/h2&gt;

&lt;p&gt;.Net Core requires an AMR32v7 processor and above, so anything Raspberry Pi 2 or better and you are good to go. Note, Raspberry Pi Zero is an ARM32v6 processor, and is not supported.&lt;/p&gt;

&lt;p&gt;The Raspberry Pi 3a Plus is a great device for .NET Core.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fraspberrypi-3a-plus.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fraspberrypi-3a-plus.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm super happy with my Raspberry Pi 4B 4GB and 8GB devices seen here dress with a heatsink case.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Faluminium-heatsink-case-for-raspberry-pi-4-black_1_1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Faluminium-heatsink-case-for-raspberry-pi-4-black_1_1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I like to use Raspberry Pi OS Lite as it takes less resources than the full Raspberry Pi Desktop version and I do all my Raspberry Pi development from my computer.&lt;/p&gt;

&lt;p&gt;If you've not set up a Raspberry Pi before then this is a great guide. "&lt;a href="https://learn.pimoroni.com/tutorial/sandyj/setting-up-a-headless-pi" rel="noopener noreferrer"&gt;Setting up a Headless Pi&lt;/a&gt;". Be sure to use the WiFi network as your development computer.&lt;/p&gt;

&lt;p&gt;If you are not comfortable setting up Raspberry Pi OS Lite (Headless), then follow the &lt;a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up" rel="noopener noreferrer"&gt;Setting up your Raspberry Pi&lt;/a&gt; guide to set up the full Raspberry Pi OS Desktop version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Optional Hardware
&lt;/h3&gt;

&lt;p&gt;The Raspberry Pi Sense HAT has builtin sensors and a LED panel. If you have one then great, one of the labs uses this HAT.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fpi-sense-hat.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fpi-sense-hat.jpg"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why .NET Core
&lt;/h2&gt;

&lt;p&gt;It used by millions of developers, it is mature, fast, supports multiple programming languages (C#, F#, and VB.NET), runs on multiple platforms (Linux, macOS, and Windows), and is supported across multiple processor architectures. It is used to build device, cloud, and IoT applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-au/dotnet/core?WT.mc_id=julyot-dnc-dglover" rel="noopener noreferrer"&gt;.NET Core&lt;/a&gt; is an &lt;a href="https://github.com/dotnet/coreclr/blob/master/LICENSE.TXT" rel="noopener noreferrer"&gt;open-source&lt;/a&gt;, general-purpose development platform maintained by Microsoft and the .NET community on &lt;a href="https://github.com/dotnet/core" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Learning C#
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fc-sharp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Fc-sharp.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are lots of great resources for learning C#. Check out the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/?WT.mc_id=julyot-dnc-dglover" rel="noopener noreferrer"&gt;C# official documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aka.ms/dotnet3-csharp" rel="noopener noreferrer"&gt;C# 101 Series with Scott Hanselman and Kendra Havens&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/LUv20QxXjfw" rel="noopener noreferrer"&gt;Full C# Tutorial Path for Beginners and Everyone Else&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The .NET Core IoT Libraries Open Source Project
&lt;/h2&gt;

&lt;p&gt;The Microsoft .NET Core team along with the developer community are building support for &lt;a href="https://en.wikipedia.org/wiki/Internet_of_things" rel="noopener noreferrer"&gt;IoT&lt;/a&gt; scenarios. The &lt;a href="https://github.com/dotnet/iot" rel="noopener noreferrer"&gt;.NET Core IoT Library&lt;/a&gt; is supported on Linux, and Windows IoT Core, across ARM and Intel processor architectures. See the &lt;a href="https://github.com/dotnet/iot/blob/master/Documentation/roadmap.md" rel="noopener noreferrer"&gt;.NET Core IoT Library Roadmap&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Device.Gpio
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://www.nuget.org/packages/System.Device.Gpio" rel="noopener noreferrer"&gt;System.Device.Gpio&lt;/a&gt;  package supports general-purpose I/O (&lt;a href="https://en.wikipedia.org/wiki/General-purpose_input/output" rel="noopener noreferrer"&gt;GPIO&lt;/a&gt;) pins, PWM, I2C, SPI and related interfaces for interacting with low-level hardware pins to control hardware sensors, displays and input devices on single-board-computers; &lt;a href="https://www.raspberrypi.org/" rel="noopener noreferrer"&gt;Raspberry Pi&lt;/a&gt;, &lt;a href="https://beagleboard.org/" rel="noopener noreferrer"&gt;BeagleBoard&lt;/a&gt;, &lt;a href="https://www.solid-run.com/nxp-family/hummingboard/" rel="noopener noreferrer"&gt;HummingBoard&lt;/a&gt;, &lt;a href="https://www.hardkernel.com/" rel="noopener noreferrer"&gt;ODROID&lt;/a&gt;, and other single-board-computers that are supported by Linux and Windows 10 IoT Core.&lt;/p&gt;

&lt;h3&gt;
  
  
  Iot.Device.Bindings
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://github.com/dotnet/iot/tree/master/src" rel="noopener noreferrer"&gt;.NET Core IoT Repository&lt;/a&gt; contains &lt;a href="https://www.nuget.org/packages/Iot.Device.Bindings" rel="noopener noreferrer"&gt;IoT.Device.Bindings&lt;/a&gt;, a growing set of community-maintained device bindings for IoT components that you can use with your .NET Core applications. If you can't find what you need then porting your own C/C++ driver libraries to .NET Core and C# is pretty straight forward too.&lt;/p&gt;

&lt;p&gt;The drivers in the repository include sample code along with wiring diagrams. For example the &lt;a href="https://github.com/dotnet/iot/tree/master/src/devices/Bmxx80" rel="noopener noreferrer"&gt;BMx280 - Digital Pressure Sensors BMP280/BME280&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Frpi-bmp280_i2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications%2Fmaster%2Fresources%2Frpi-bmp280_i2c.png"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Raspberry Pi .NET Core Developer Learning Path
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Lab 1: &lt;a href="https://github.com/gloveboxes/Create-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications/blob/master/labs/Lab_1_Build_dot_NET_Core_app/README.md" rel="noopener noreferrer"&gt;Create your  first Raspberry Pi .NET Core C# IoT Application&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Lab 2: &lt;a href="https://github.com/gloveboxes/Create-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications/blob/master/labs/Lab_2_Azure_IoT_Central/README.md" rel="noopener noreferrer"&gt;Connect a HVAC room environment monitor to Azure IoT Central&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Lab 3: &lt;a href="https://github.com/gloveboxes/Create-RaspberryPi-dotNET-Core-C-Sharp-IoT-Applications/blob/master/labs/Lab_3_IoT_Central_and_Device_Twins/README.md" rel="noopener noreferrer"&gt;Remote control the room temperature&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Have fun and stay safe and be sure to follow us on &lt;a href="https://twitter.com/hashtag/JulyOT?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#JulyOT&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>raspberrypi</category>
      <category>iot</category>
      <category>julyot</category>
      <category>azure</category>
    </item>
    <item>
      <title>Build a Rover combining the best of Azure Sphere security with FreeRTOS</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Wed, 22 Jul 2020 03:40:20 +0000</pubDate>
      <link>https://forem.com/azure/build-a-rover-combining-the-best-of-azure-sphere-security-with-freertos-1k3h</link>
      <guid>https://forem.com/azure/build-a-rover-combining-the-best-of-azure-sphere-security-with-freertos-1k3h</guid>
      <description>&lt;h1&gt;
  
  
  Build a Rover combining the best of Azure Sphere security with FreeRTOS
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VLsF6E6n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/architecture.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VLsF6E6n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/architecture.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What you will learn
&lt;/h2&gt;

&lt;p&gt;You will learn how to integrate a Real-time FreeRTOS application responsible for running a timing-sensitive ultrasonic distance sensor with the security and cloud connectivity of Azure Sphere.&lt;/p&gt;




&lt;h2&gt;
  
  
  #JulyOT
&lt;/h2&gt;

&lt;p&gt;This is part of the #JulyOT &lt;a href="http://aka.ms/julyot"&gt;IoT Tech Community&lt;/a&gt; series, a collection of blog posts, hands-on-labs, and videos designed to demonstrate and teach developers how to build projects with Azure Internet of Things (IoT) services. Please also follow &lt;a href="https://twitter.com/hashtag/JulyOT"&gt;#JulyOT&lt;/a&gt; on Twitter.&lt;/p&gt;




&lt;h2&gt;
  
  
  Source code and learning resources
&lt;/h2&gt;

&lt;p&gt;Source code: &lt;a href="https://gloveboxes.github.io/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/"&gt;Azure Sphere seeing eyed rover Real-time FreeRTOS sensors and Azure IoT&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Learning resources: &lt;a href="https://github.com/gloveboxes/Azure-Sphere-Learning-Path"&gt;Azure Sphere Developer Learning Path&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Learn more about Azure Sphere
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://azure.microsoft.com/en-au/services/azure-sphere/?WT.mc_id=julyot-rover-dglover"&gt;Azure Sphere&lt;/a&gt; is a comprehensive IoT security solution – including hardware, OS, and cloud components – to actively protect your devices, your business, and your customers.&lt;/p&gt;

&lt;p&gt;Azure Sphere is made up of three interrelated components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Azure Sphere-certified MCUs&lt;/li&gt;
&lt;li&gt;Azure Sphere OS&lt;/li&gt;
&lt;li&gt;Azure Sphere Security Service&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KNZ6et1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/azure-sphere-end-to-end.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KNZ6et1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/azure-sphere-end-to-end.png" alt="Azure Sphere end-to-end"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Azure Sphere Architecture
&lt;/h2&gt;

&lt;p&gt;The Azure Sphere is built on the Mediatec MT3620. This crossover MCU consists of 5 cores. There is a dedicated communications core, a dedicated Security Subsystem core, and &lt;strong&gt;three&lt;/strong&gt; user application cores.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;three applications cores&lt;/strong&gt; are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 x  ARM Cortex A7 core running Embedded Linux (built with Yokto), exposing a set of POSIX APIs. Developers can build and deploy a &lt;strong&gt;High-level&lt;/strong&gt; application to this core. This core is also responsible for the TrustZone Security Monitor, threat detection reporting, and OS and Application life cycle management.&lt;/li&gt;
&lt;li&gt;2 x ARM Cortex M4Fs. Developers can build and deploy &lt;strong&gt;Real-time&lt;/strong&gt; applications to these cores. Real-time applications can be built against the bare metal or built using  Real-time frameworks such as FreeRTOS and Azure RTOS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;a href="https://visualstudio.microsoft.com/downloads/?WT.mc_id=julyot-rover-dglover"&gt;Visual Studio&lt;/a&gt; (free community edition or better) or &lt;a href="https://code.visualstudio.com/?WT.mc_id=julyot-rover-dglover"&gt;Visual Studio Code&lt;/a&gt;, you can develop and debug applications running on all three cores. For example, you can simultaneously debug an app running on the A7 core and a M4 core FreeRTOS app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vGUQg20p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/azure-sphere-architecture.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vGUQg20p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/azure-sphere-architecture.png" alt="Azure Sphere architecture"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Application architecture
&lt;/h2&gt;

&lt;p&gt;The application running on the Azure Sphere consists of two parts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iQnkl-wP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/application-architecture.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iQnkl-wP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/application-architecture.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-time FreeRTOS Application
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The Real-time FreeRTOS application running on one of the M4 cores that is responsible for running the timing-sensitive HC-SR04 ultrasonic distance sensor.&lt;/li&gt;
&lt;li&gt;Distance is measured every 100 milliseconds so the rover can decide the best route.&lt;/li&gt;
&lt;li&gt;The sensor requires precise microsecond timing to trigger the distance measurement process, so it is a perfect candidate for running on the Real-time core as a FreeRTOS Task.&lt;/li&gt;
&lt;li&gt;Every 5 seconds a FreeRTOS Task sends distance telemetry to the Azure Sphere A7 High-level application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Azure IoT High-level Application
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The application running on the Azure Sphere A7 High-level application core is responsible for less timing-sensitive tasks such as establishing WiFi/Network connectivity, negotiating security and connecting with Azure IoT Central, updating the device twin and send telemetry messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Extending
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I am thinking about extending this solution with a local TinyML module for smarter navigation.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Parts list
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;1 x &lt;a href="https://www.seeedstudio.com/mt3620-for-azure-sphere"&gt;Seeed Studio Seeed Studio MT3620 Mini Dev Board&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;1 x &lt;a href="https://www.seeedstudio.com/MT3620-Grove-Breakout-p-4043.html"&gt;MT3620 Grove Breakout&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;2 x &lt;a href="https://www.seeedstudio.com/Grove-Ultrasonic-Distance-Sensor.html"&gt;Grove - Ultrasonic Distance Sensor&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;1 x H-Bridge driver. Seeed Studio have a &lt;a href="https://wiki.seeedstudio.com/Grove-I2C_Motor_Driver_V1.3/"&gt;Grove - I2C Motor Driver&lt;/a&gt;, or you can wire up your own H-Bridge connector to the Grove Breakout board.&lt;/li&gt;
&lt;li&gt;1 x Rover chassis, motors, wheels etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MYgTc1yj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/IMG_0172_cropped.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MYgTc1yj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/IMG_0172_cropped.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Azure IoT Central
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://azure.microsoft.com/en-in/services/iot-central/?WT.mc_id=julyot-rover-dglover"&gt;Azure IoT Central&lt;/a&gt; provides an easy way to connect, monitor, and manage your Internet of Things (IoT) assets at scale.&lt;/p&gt;

&lt;p&gt;I created a free trial of &lt;a href="https://azure.microsoft.com/en-gb/services/iot-central/?WT.mc_id=julyot-rover-dglover"&gt;Azure IoT Central&lt;/a&gt; and in no time I had the rover distance sensor charted and available for deeper analysis. By the way, you can continue to connect two devices for free to IoT Central after the trial period expires.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CO-TACF5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/iot-central-distance-chart.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CO-TACF5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Azure-Sphere-Rover-Bot-FreeRTOS-with-Azure-IoT/master/resources/iot-central-distance-chart.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Extend and integrate Azure IoT Central applications with other cloud services
&lt;/h3&gt;

&lt;p&gt;Azure IoT Central is also extensible using rules and workflows. For more information, review &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/core/howto-configure-rules-advanced?WT.mc_id=julyot-rover-dglover"&gt;Use workflows to integrate your Azure IoT Central application with other cloud services&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  How to build the solution
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Set up your &lt;a href="https://github.com/gloveboxes/Azure-Sphere-Learning-Path/tree/master/zdocs_visual_studio_iot_central/Lab_0_Introduction_and_Lab_Set_Up"&gt;Azure Sphere development environment&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Review &lt;a href="https://github.com/gloveboxes/Azure-Sphere-Learning-Path/tree/master/zdocs_visual_studio_iot_central/Lab_5_FreeRTOS_and_Inter-Core_Messaging"&gt;Integrate FreeRTOS Real-time room sensors with Azure IoT&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to connect and Azure Sphere to &lt;a href="https://github.com/gloveboxes/Azure-Sphere-Learning-Path/tree/master/zdocs_visual_studio_iot_central/Lab_2_Send_Telemetry_to_Azure_IoT_Central"&gt;Azure IoT Central&lt;/a&gt; or &lt;a href="https://github.com/gloveboxes/Azure-Sphere-Learning-Path/tree/master/zdocs_vs_code_iot_hub/Lab_2_Send_Telemetry_to_Azure_IoT_Hub"&gt;Azure IoT Hub&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The IoT Central Device Template Capabilities Model JSON file for this solution is included in the &lt;strong&gt;iot_central&lt;/strong&gt; directory of this repo.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Have fun and stay safe and be sure to follow us on &lt;a href="https://twitter.com/hashtag/JulyOT?src=hash&amp;amp;ref_src=twsrc%5Etfw"&gt;#JulyOT&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>azuresphere</category>
      <category>iot</category>
      <category>freertos</category>
      <category>julyot</category>
    </item>
    <item>
      <title>Improve health, wellbeing, and productivity by tracking your home workspace CO2 levels</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Fri, 17 Jul 2020 11:23:27 +0000</pubDate>
      <link>https://forem.com/azure/improve-wellbeing-and-build-a-healthier-workspace-by-tracking-co2-levels-2h23</link>
      <guid>https://forem.com/azure/improve-wellbeing-and-build-a-healthier-workspace-by-tracking-co2-levels-2h23</guid>
      <description>&lt;h1&gt;
  
  
  Improve health, wellbeing, and productivity by tracking your home workspace CO2 levels
&lt;/h1&gt;

&lt;p&gt;How to build a healthier working environment by monitoring CO2, temperature, and humidity levels with an &lt;a href="https://azure.microsoft.com/en-gb/services/azure-sphere/?WT.mc_id=julyot-co2-dglover" rel="noopener noreferrer"&gt;Azure Sphere device&lt;/a&gt;, an &lt;a href="https://www.seeedstudio.com/Grove-CO2-Temperature-Humidity-Sensor-SCD30-p-2911.html" rel="noopener noreferrer"&gt;SDC30 sensor&lt;/a&gt;, and &lt;a href="https://azure.microsoft.com/en-gb/services/iot-central/?WT.mc_id=julyot-co2-dglover" rel="noopener noreferrer"&gt;Azure IoT Central&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  #JulyOT
&lt;/h2&gt;

&lt;p&gt;This is part of the #JulyOT &lt;a href="http://aka.ms/julyot" rel="noopener noreferrer"&gt;IoT Tech Community&lt;/a&gt; series, a collection of  blog posts, hands-on-labs, and videos designed to demonstrate and teach developers how to build projects with Azure Internet of Things (IoT) services. Please also follow &lt;a href="https://twitter.com/hashtag/JulyOT" rel="noopener noreferrer"&gt;#JulyOT&lt;/a&gt; on Twitter.&lt;/p&gt;




&lt;h2&gt;
  
  
  Are CO2 levels making you grumpy, sleepy, or sad
&lt;/h2&gt;

&lt;p&gt;Working from home it is easy to close the door to shut out the noise of everyday life while we get on with work. Closing the door can lead to a build-up of CO2 gas, a by-product of our breathing, which can impact our wellbeing, concentration, and productivity levels.&lt;/p&gt;

&lt;p&gt;Check out "&lt;a href="https://www.theguardian.com/environment/2019/jul/08/indoor-carbon-dioxide-levels-could-be-a-health-hazard-scientists-warn" rel="noopener noreferrer"&gt;Indoor carbon dioxide levels could be a health hazard, scientists warn&lt;/a&gt;".&lt;/p&gt;

&lt;p&gt;The problem is we cannot see or smell Carbon Dioxide, it just keeps building up, and we have no way of knowing it is happening other than getting tired or a headache. So, with that in mind, I figured it was the Internet of Things to the rescue!&lt;/p&gt;




&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;I wanted to build a secure IoT device with &lt;a href="https://azure.microsoft.com/en-gb/services/azure-sphere/?WT.mc_id=julyot-co2-dglover" rel="noopener noreferrer"&gt;Azure Sphere&lt;/a&gt; using the &lt;a href="https://www.seeedstudio.com/Grove-CO2-Temperature-Humidity-Sensor-SCD30-p-2911.html" rel="noopener noreferrer"&gt;Seeed Studio Grove CO2 &amp;amp; Temperature &amp;amp; Humidity Sensor&lt;/a&gt; sensor I had in my box of bits. The folks at Sensirion made it super easy to port their &lt;a href="https://github.com/Sensirion/embedded-scd" rel="noopener noreferrer"&gt;SCD30 driver&lt;/a&gt; to Azure Sphere. It was just a matter of implementing the I2C init/read/write functions, a microsecond sleep function, plus setting up CMake build. It all just worked. The ported driver is included in this project.&lt;/p&gt;




&lt;h2&gt;
  
  
  Azure IoT Central
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://azure.microsoft.com/en-in/services/iot-central/?WT.mc_id=julyot-co2-dglover" rel="noopener noreferrer"&gt;Azure IoT Central&lt;/a&gt; provides an easy way to connect, monitor, and manage your Internet of Things (IoT) assets at scale.&lt;/p&gt;

&lt;p&gt;I created a free trial of &lt;a href="https://azure.microsoft.com/en-gb/services/iot-central/?WT.mc_id=julyot-co2-dglover" rel="noopener noreferrer"&gt;Azure IoT Central&lt;/a&gt; and in no time I had CO2, temperature, and humidity telemetry displayed (yes, the data is real, so we have made some changes at home!). By the way, you can continue to connect two devices for free to IoT Central after the trial period expires.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCO2-levels-making-you-happy-grumpy-sleepy-or-sad%2Fmaster%2Fresources%2Fiot-central-dash.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCO2-levels-making-you-happy-grumpy-sleepy-or-sad%2Fmaster%2Fresources%2Fiot-central-dash.png"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Parts list
&lt;/h2&gt;

&lt;p&gt;The solution supports two configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Seeed Studio Azure Sphere Mini Dev Board
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.seeedstudio.com/mt3620-for-azure-sphere" rel="noopener noreferrer"&gt;Seeed Studio Seeed Studio MT3620 Mini Dev Board&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.seeedstudio.com/MT3620-Grove-Breakout-p-4043.html" rel="noopener noreferrer"&gt;MT3620 Grove Breakout&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.seeedstudio.com/Grove-CO2-Temperature-Humidity-Sensor-SCD30-p-2911.html" rel="noopener noreferrer"&gt;Seeed Studio Grove CO2 &amp;amp; Temperature &amp;amp; Humidity Sensor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Optional, &lt;a href="https://www.seeedstudio.com/Grove-Green-LED.html" rel="noopener noreferrer"&gt;3 x Grove LEDs&lt;/a&gt;, or a &lt;a href="https://www.seeedstudio.com/Grove-Relay.html" rel="noopener noreferrer"&gt;Grove Relay&lt;/a&gt; to drive a bigger warning light!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCO2-levels-making-you-happy-grumpy-sleepy-or-sad%2Fmaster%2Fresources%2Fseeed_studio-azure-sphere_mini-co2-monitor.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCO2-levels-making-you-happy-grumpy-sleepy-or-sad%2Fmaster%2Fresources%2Fseeed_studio-azure-sphere_mini-co2-monitor.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  AVNET Azure Sphere Starter Kit
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.avnet.com/shop/us/products/avnet-engineering-services/aes-ms-mt3620-sk-g-3074457345636825680/" rel="noopener noreferrer"&gt;AVNET Azure Sphere Starter Kit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.seeedstudio.com/Grove-CO2-Temperature-Humidity-Sensor-SCD30-p-2911.html" rel="noopener noreferrer"&gt;Seeed Studio Grove CO2 &amp;amp; Temperature &amp;amp; Humidity Sensor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Optional, 1 x &lt;a href="https://www.mikroe.com/relay-click" rel="noopener noreferrer"&gt;Click Relay&lt;/a&gt; to drive a bigger warning light.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCO2-levels-making-you-happy-grumpy-sleepy-or-sad%2Fmaster%2Fresources%2Favnet_azure_sphere_starter_kit.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCO2-levels-making-you-happy-grumpy-sleepy-or-sad%2Fmaster%2Fresources%2Favnet_azure_sphere_starter_kit.jpg"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Follow the complete guide to "&lt;a href="https://gloveboxes.github.io/Track-CO2-levels-in-your-workspace-to-improve-health-wellbeing-and-productivity/" rel="noopener noreferrer"&gt;Track CO2 levels in your workspace to improve health, wellbeing, and productivity&lt;/a&gt;"&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning resources
&lt;/h3&gt;

&lt;p&gt;Learning resources: &lt;a href="https://github.com/gloveboxes/Azure-Sphere-Learning-Path" rel="noopener noreferrer"&gt;Azure Sphere Developer Learning Path&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Have fun, stay safe, and be sure to follow us on &lt;a href="https://twitter.com/hashtag/JulyOT" rel="noopener noreferrer"&gt;#JulyOT&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>azuresphere</category>
      <category>iot</category>
      <category>microsoftiot</category>
      <category>julyot</category>
    </item>
    <item>
      <title>Introducing Azure Sphere Developer Learning Path Labs on GitHub</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Wed, 29 Apr 2020 04:55:32 +0000</pubDate>
      <link>https://forem.com/azure/introducing-azure-sphere-developer-learning-path-labs-on-github-15aa</link>
      <guid>https://forem.com/azure/introducing-azure-sphere-developer-learning-path-labs-on-github-15aa</guid>
      <description>&lt;p&gt;IoT security is a critical challenge touching every aspect of our lives. Security is complex, expensive, and ever-changing as hackers become more cunning. Azure Sphere builds on decades of Microsoft and industry security experience with a unique blend of hardware, device and cloud services that enables you to create “Secure by default” IoT solutions. &lt;/p&gt;

&lt;p&gt;The &lt;a href="https://aka.ms/azure-sphere-developer-learning-path"&gt;Azure Sphere Developer Learning Path&lt;/a&gt; is a series of labs designed to ease you into the world of Azure Sphere development with the Avnet and Seeed Studio Azure Sphere development boards. &lt;/p&gt;

&lt;p&gt;The labs cover Azure Sphere security concepts, secure bi-directional cloud communications, how to integrate FreeRTOS Real-Time applications with the Azure, and over the air updates, with more labs to follow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TTuIovFC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/gloveboxes/Azure-Sphere-Learning-Path/blob/master/zdocs/resources/azure-sphere-end-to-end.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TTuIovFC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/gloveboxes/Azure-Sphere-Learning-Path/blob/master/zdocs/resources/azure-sphere-end-to-end.png%3Fraw%3Dtrue" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://azure.microsoft.com/services/azure-sphere/"&gt;Learn more about Azure Sphere&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These labs include several libraries used to abstract underlying complexity allowing you to focus on the problems you are trying to solve with cleaner and more manageable code. You are free to use these libraries in your projects and contribute back.&lt;/p&gt;

&lt;p&gt;Start, or reignite your Azure Sphere development projects and learn how to build “Secure by Default” IoT solutions with the “&lt;a href="https://aka.ms/azure-sphere-developer-learning-path"&gt;Azure Sphere Developer Learning Path&lt;/a&gt;” labs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Modules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/learn/modules/develop-secure-iot-solutions-azure-sphere-iot-central?WT.mc_id=iot-10976-dglover"&gt;Develop highly secure IoT solutions with Azure Sphere, Azure RTOS and IoT Central&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/learn/modules/develop-secure-iot-solutions-azure-sphere-iot-hub?WT.mc_id=iot-11691-dglover"&gt;Develop highly secure IoT solutions with Azure Sphere, Azure RTOS and IoT Hub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learn more about "&lt;a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2017/03/SevenPropertiesofHighlySecureDevices.pdf"&gt;The Seven Properties of Highly Secure Devices&lt;/a&gt;".&lt;/p&gt;

&lt;p&gt;For questions and support head to &lt;a href="https://docs.microsoft.com/en-us/azure-sphere/resources/support"&gt;Azure Sphere Support&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>azuresphere</category>
      <category>freertos</category>
      <category>msiot</category>
      <category>iot</category>
    </item>
    <item>
      <title>Skippy, Kenny, and Willy need our help - Day 17 of the #25DaysOfServerless Challenge</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Thu, 19 Dec 2019 12:26:24 +0000</pubDate>
      <link>https://forem.com/azure/skippy-kenny-and-willy-need-our-help-day-17-of-the-25daysofserverless-challenge-4ed6</link>
      <guid>https://forem.com/azure/skippy-kenny-and-willy-need-our-help-day-17-of-the-25daysofserverless-challenge-4ed6</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Favocados.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Favocados.png"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;This article is part of &lt;a href="https://25daysofserverless.com/" rel="noopener noreferrer"&gt;#25DaysOfServerless&lt;/a&gt;. New challenges will be published every day from Microsoft Cloud Advocates throughout the month of December. Find out more about how Microsoft Azure enables your &lt;a href="https://docs.microsoft.com/azure/azure-functions/?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Serverless functions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Have an idea or a solution? &lt;a href="https://twitter.com/intent/tweet?text=I%27m%20joining%20the%20@azureadvocates%20%2325DaysOfServerless%20challenge!!%20Learn%20more%20at%20https://aka.ms/25daysofserverless%20or%20see%20solutions%20at%20https://dev.to/search?q=25DaysOfServerless!%20Join%20me!"&gt;Share your thoughts on Twitter!&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Time for an Australian Christmas day BBQ on the beach.&lt;/p&gt;

&lt;p&gt;Skippy the Kangaroo, and his mates, Kenny the Koala, and Willy the Wombat were very excited and looking forward to Christmas. ‘Only one more sleep’ said Kenny the Koala, ‘I have been very good all year’. Skippy and Willy looked at each other and rolled their eyes, ‘you have not been that good’ they thought. Skippy reminded his mates, ‘it’s not all about presents, my favourite part of Christmas is going to the beach, firing up the BBQ, having a nice cold beer, and relaxing with my friends and family. Let’s hope it a sunny day’.&lt;/p&gt;




&lt;p&gt;Write an Internet or Things Serverless solution that helps Skippy, Kenny, and Willy know if it’s a warm day at the beach. You can use the Raspberry Pi Simulator (or a real Raspberry Pi) to send temperature data to Azure IoT Hub to trigger a Python Azure Function. The Azure Function will send a tweet to let our friends know the temperate is greater than 31 degrees (88 Fahrenheit) and it is time to head to the beach for a truly Australian Christmas day.&lt;/p&gt;




&lt;h2&gt;
  
  
  Create an Azure IoT Hub, Register a device and Test
&lt;/h2&gt;

&lt;p&gt;The Azure IoT Raspberry Pi Simulator is a great way to get started building an Azure IoT Solution.&lt;/p&gt;

&lt;p&gt;Follow the documentation to &lt;a href="https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-web-simulator-get-started?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Connect Raspberry Pi online simulator to Azure IoT Hub&lt;/a&gt;. When you create an Azure IoT Hub be sure to select the &lt;strong&gt;Free Tier&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Event Hub Connection Information
&lt;/h3&gt;

&lt;p&gt;When you have created your Azure IoT Hub then navigate to the Azure IoT Hub &lt;strong&gt;Built-in endpoints&lt;/strong&gt; blade. You will need the &lt;strong&gt;Event Hub compatible name&lt;/strong&gt; and the &lt;strong&gt;Event Hub compatible endpoint&lt;/strong&gt; when you create the Python Azure Function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fazure-iot-enpoints.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fazure-iot-enpoints.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Python Azure Function
&lt;/h2&gt;

&lt;p&gt;Install the following &lt;a href="https://code.visualstudio.com/?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt; extensions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions&amp;amp;WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Visual Studio Code Azure Functions Extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python&amp;amp;WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Visual Studio Code Python Extension&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow the &lt;a href="https://docs.microsoft.com/en-us/azure/python/tutorial-vs-code-serverless-python-02?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Tutorial: Create a Python function for Azure Functions tutorial&lt;/a&gt;. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select &lt;strong&gt;Python&lt;/strong&gt; as the language for the function project&lt;/li&gt;
&lt;li&gt;Optional, but recommended, create a virtual environment&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Azure Event Hub trigger&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Name your Event Hub Trigger&lt;/li&gt;
&lt;li&gt;Create new local app settings&lt;/li&gt;
&lt;li&gt;Select your subscription&lt;/li&gt;
&lt;li&gt;When prompted to select an event hub namespace select &lt;strong&gt;Skip for now&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Paste the Azure IoT Hub &lt;strong&gt;Event Hub compatible name&lt;/strong&gt; as the name of the event hub from which to trigger.glovebox-iothub
9 Select the &lt;strong&gt;$Default&lt;/strong&gt; Event Hub consumer group&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Configure the Azure IoT Hub Connection String
&lt;/h3&gt;

&lt;p&gt;When the Visual Studio Code has finished creating the project open the &lt;strong&gt;function.json&lt;/strong&gt; file. The &lt;strong&gt;connection&lt;/strong&gt; property will be an empty string. Modify the value of the &lt;strong&gt;connection&lt;/strong&gt; property to &lt;strong&gt;IotHubConnectionString&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fiot-hub-connection-string.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fiot-hub-connection-string.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the IoT Hub Connection String Environment Variable
&lt;/h3&gt;

&lt;p&gt;Open the &lt;strong&gt;local.settings.json&lt;/strong&gt; file and create a new property named &lt;strong&gt;IotHubConnectionString&lt;/strong&gt; and set the value to the Azure IoT Hub &lt;strong&gt;Event Hub compatible endpoint&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fiot-hub-connection-string-variable.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fiot-hub-connection-string-variable.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Start the Azure Storage Local Emulator
&lt;/h2&gt;

&lt;p&gt;Azure Functions need access to Azure Storage Emulator for logging and checkpointing. When developing functions it can be fast to use the Azure Storage Local Emulator.&lt;/p&gt;

&lt;p&gt;To Install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On Windows install and start the &lt;a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Azure storage emulator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;On macOS and Linux install and start &lt;a href="https://github.com/azure/azurite" rel="noopener noreferrer"&gt;Azurite&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Test the Python Azure Function
&lt;/h2&gt;

&lt;p&gt;Now is a great time to test the Python Azure Function is triggered by new messages sent from the Raspberry Pi Simulator.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Ensure the Raspberry Pi Simulator is running and sending telemetry. Configure the Azure IoT Hub Device Connection string and click &lt;strong&gt;Run&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Frpi-simulator.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Frpi-simulator.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;&lt;strong&gt;init&lt;/strong&gt;.py&lt;/strong&gt; file and set a breakpoint on line 7.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fpython-azure-function-start.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fpython-azure-function-start.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press F5 to start the Azure Function from Visual Studio Code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Function will start and when a collection of messages arrive from Azure IoT hub the breakpoint will be hit.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Process the Incoming Messages
&lt;/h3&gt;

&lt;p&gt;Replace the Python code in the &lt;strong&gt;init&lt;/strong&gt;.py file with the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;azure.functions&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EventHubEvent&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_body&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;telemetry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;telemetry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temperature&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Python telemetry object is an array of JSON objects. The code loops through the JSON collection and validates that the temperature object is of type float and greater than 31 and less than 40.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrating the Azure Function with Twitter
&lt;/h3&gt;

&lt;p&gt;Follow the &lt;a href="https://projects.raspberrypi.org/en/projects/getting-started-with-the-twitter-api" rel="noopener noreferrer"&gt;Getting started with the Twitter API&lt;/a&gt; documentation.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;a href="https://developer.twitter.com/" rel="noopener noreferrer"&gt;Twitter Application&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the Twitter authorisation information to the local.settings.json file rather than the auth.py.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Ftwitter-authorisation.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Ftwitter-authorisation.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Load these environment variables when your Python Function starts and add&lt;br&gt;
&lt;br&gt;
&lt;code&gt;python from twython import Twython&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
to the function.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;twython&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Twython&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;azure.functions&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;

&lt;span class="n"&gt;consumer_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;consumer_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;consumer_secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;consumer_secret&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;access_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;access_token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;access_token_secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;access_token_secret&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EventHubEvent&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_body&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;telemetry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;telemetry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temperature&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Install twython Python Twitter Library
&lt;/h3&gt;

&lt;p&gt;1.&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;bash pip3 install twython&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add &lt;strong&gt;twython&lt;/strong&gt; to the project requirements file. This will be needed when you package up the solution and deploy to Azure.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Integrate with Twitter
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Update the Pthyon code in the &lt;strong&gt;init&lt;/strong&gt;.py file as follows:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;twython&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Twython&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;azure.functions&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;

&lt;span class="n"&gt;consumer_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;consumer_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;consumer_secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;consumer_secret&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;access_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;access_token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;access_token_secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;access_token_secret&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;twitter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Twython&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;consumer_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;consumer_secret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;access_token_secret&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sendTwitterMsg&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hey Skippy, Kenny, and Willy, time for an Australian Christmas Day on the beach #25DaysOfServerless&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;twitter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;problem tweeting from the Python Function&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Tweeted: %s&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EventHubEvent&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_body&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;telemetry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;telemetry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temperature&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save the changes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set a breakpoint in the&lt;br&gt;
&lt;br&gt;
&lt;code&gt;python def sendTwitterMsg():&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press F5 to rerun the function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure the Raspberry Pi Simulator is running and sending telemetry&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check Twitter, you should see your message telling Skippy, Kenny, and Willy they should head to the beach.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Finished 完了 fertig finito ख़त्म होना terminado
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fcongratulations.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FServerless-IoT-and-Python-Functions%2Fmaster%2Fresources%2Fcongratulations.jpg"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Want to submit your solution to this challenge? Build a solution locally and then &lt;a href="https://github.com/microsoft/25-days-of-serverless/pulls" rel="noopener noreferrer"&gt;PR this repo&lt;/a&gt;. If your solution doesn't involve code you can record a short video and submit it as a PR to the same repo. Make sure to tell us which challenge the solution is for. We're excited to see what you build! Do you have comments or questions? Add them to the comments area below.&lt;/p&gt;




&lt;p&gt;Watch for surprises all during December as we celebrate 25 Days of Serverless. Stay tuned here on dev.to as we feature challenges and solutions! Sign up for a &lt;a href="https://azure.microsoft.com/free/?WT.mc_id=25days_devto-blog-cxa" rel="noopener noreferrer"&gt;free account on Azure&lt;/a&gt; to get ready for the challenges!&lt;/p&gt;

</description>
      <category>msiot</category>
      <category>raspberrypi</category>
      <category>25daysofserverless</category>
    </item>
    <item>
      <title>Create a Secure Azure Sphere App using the Grove Shield Sensor Kit</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Tue, 17 Dec 2019 05:46:59 +0000</pubDate>
      <link>https://forem.com/azure/create-a-secure-azure-sphere-app-using-the-grove-shield-sensor-kit-37bg</link>
      <guid>https://forem.com/azure/create-a-secure-azure-sphere-app-using-the-grove-shield-sensor-kit-37bg</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mP4oAh1C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/azure-sphere-shield.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mP4oAh1C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/azure-sphere-shield.png" alt="Azure Sphere with shield"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow me on Twitter &lt;a href="https://twitter.com/dglover"&gt;@dglover&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Author&lt;/th&gt;
&lt;th&gt;
&lt;a href="https://developer.microsoft.com/en-us/advocates/dave-glover?WT.mc_id=devto-blog-dglover"&gt;Dave Glover&lt;/a&gt;, Microsoft Cloud Developer Advocate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Target Platform&lt;/td&gt;
&lt;td&gt;Seeed Studio Azure Sphere MT3620&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer Platform&lt;/td&gt;
&lt;td&gt;Windows 10 or Ubuntu 18.04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Azure SDK&lt;/td&gt;
&lt;td&gt;Azure Sphere SDK 19.11 or better&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer Tools&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://visualstudio.microsoft.com/vs/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio (The free Community Edition or better)&lt;/a&gt; or &lt;a href="https://code.visualstudio.com?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code (Free OSS)&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hardware&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://www.seeedstudio.com/MT3620-Grove-Shield.html"&gt;Seeed Studio Grove Shield&lt;/a&gt;, and the &lt;a href="https://www.seeedstudio.com/Grove-Temperature-Humidity-Sensor-SHT31.html"&gt;Grove Temperature and Humidity Sensor (SHT31)&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Language&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date&lt;/td&gt;
&lt;td&gt;As of December, 2019&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What is Azure Sphere
&lt;/h2&gt;

&lt;p&gt;Azure Sphere is a secured, high-level application platform with built-in communication and security features for internet-connected devices.&lt;/p&gt;

&lt;p&gt;It comprises a secured, connected, crossover microcontroller unit (MCU), a custom high-level Linux-based operating system (OS), and a cloud-based security service that provides continuous, renewable security.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hardware Required
&lt;/h2&gt;

&lt;p&gt;This tutorial requires the &lt;a href="https://www.seeedstudio.com/Azure-Sphere-MT3620-Development-Kit-US-Version-p-3052.html"&gt;Seeed Studio Azure Sphere&lt;/a&gt;, the &lt;a href="https://www.seeedstudio.com/MT3620-Grove-Shield.html"&gt;Seeed Studio Grove Shield&lt;/a&gt;, and the &lt;a href="https://www.seeedstudio.com/Grove-Temperature-Humidity-Sensor-SHT31.html"&gt;Grove Temperature and Humidity Sensor (SHT31)&lt;/a&gt;. These parts are available from many online stores including &lt;a href="//www.seeedstudio.com"&gt;Seeed Studio&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Be sure to plug the Grove Temperature Sensor into one of the I2C connectors on the Grove Shield.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set up your Development Environment
&lt;/h2&gt;

&lt;p&gt;This tutorial assumes Windows 10 and &lt;a href="https://visualstudio.microsoft.com/vs/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio (The free Community Edition or better)&lt;/a&gt;. For now, Azure Sphere templates are only available for Visual Studio. However, you can clone and open this solution on Windows and Ubuntu 18.04 with &lt;a href="https://code.visualstudio.com/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Follow the Azure Sphere &lt;a href="https://docs.microsoft.com/en-au/azure-sphere/install/overview?WT.mc_id=devto-blog-dglover"&gt;Overview of set up procedures&lt;/a&gt; guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Sphere SDK
&lt;/h2&gt;

&lt;p&gt;This tutorial assumes you are using the &lt;a href="https://docs.microsoft.com/en-us/azure-sphere/resources/release-notes-1911?WT.mc_id=devto-blog-dglover"&gt;Azure Sphere SDK 19.11&lt;/a&gt; or better which uses the CMake Build System.&lt;/p&gt;

&lt;p&gt;This tutorial uses a fork of the Seeed Studio &lt;a href="https://github.com/Seeed-Studio/MT3620_Grove_Shield"&gt;Grove Shield Library&lt;/a&gt; that has been updated to support Azure Sphere SDK 19.11.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clone the MT3620 Grove Shield Library
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a folder where you plan to build your Azure Sphere applications.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Clone the MT3620 Grove Shield Library.&lt;/p&gt;

&lt;p&gt;Open a command window and change to the directory where you plan to build your Azure Sphere applications.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/gloveboxes/MT3620_Grove_Shield.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Create a new Visual Studio Azure Sphere Project
&lt;/h2&gt;

&lt;p&gt;Start Visual Studio and create a new project in the same directory you cloned the MT3620 Grove Shield Library.&lt;/p&gt;

&lt;p&gt;It is important to create the Visual Studio Project in the same folder you cloned the MT3620 Grove Shield as there are relative links to this library in the application you will create.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;azure-sphere
    |- MT3620_Grove_Shield
    |- YourAzureSphereApplication
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WOHtsiHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-create-new-project.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WOHtsiHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-create-new-project.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Select Azure Sphere Project Template
&lt;/h3&gt;

&lt;p&gt;Type &lt;strong&gt;sphere&lt;/strong&gt; in the search box and select the Azure Sphere Blink template.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o88DBhTo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-select-azure-sphere-blink.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o88DBhTo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-select-azure-sphere-blink.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure new Azure Sphere Project
&lt;/h3&gt;

&lt;p&gt;Name the project and set the save location.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Oa2diL3---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-configure-new-project.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Oa2diL3---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-configure-new-project.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Open the CMakeLists.txt file
&lt;/h3&gt;

&lt;p&gt;CMakelists.txt defines the build process, the files and locations of libraries and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zDpHtN3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-open-cmakelists.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zDpHtN3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-open-cmakelists.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Add a Reference to MT3620_Grove_Shield_Library
&lt;/h3&gt;

&lt;p&gt;Two items need to be added:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The source location on the MT3620 Grove Shield library. Note, this is the relative path to the Grove Shield library.&lt;/li&gt;
&lt;li&gt;Add MT3620_Grove_Shield_Library to the target_link_libraries definition. This is equivalent to adding a reference.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OjK68VMc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-configure-cmakelists.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OjK68VMc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-configure-cmakelists.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Set the Application Capabilities
&lt;/h2&gt;

&lt;p&gt;The application manifest defines what resources will be available to the application. Define the minimum set of privileges required by the application. This is core to Azure Sphere security and is also known as the &lt;a href="https://en.wikipedia.org/wiki/Principle_of_least_privilege"&gt;Principle of least privilege&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Review the Grove Shield Sensor Capabilities Quick Reference to understand what capabilities are required for each sensor in the library.&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;app_manifest.json&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add Uart &lt;strong&gt;ISU0&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Note, access to the I2C SHT31 temperature/humidity sensor via the Grove Shield was built before Azure Sphere supported I2C. Hence calls to the sensor are proxied via the Uart.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Note, GPIO 9 is used to control an onboard LED.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"SchemaVersion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AzureSphereBlink1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ComponentId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"a3ca0929-5f46-42b0-91ba-d5de1222da86"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"EntryPoint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/bin/app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"CmdArgs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Capabilities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Gpio"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Uart"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ISU0"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"AllowedApplicationConnections"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ApplicationType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Default"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Update the Code
&lt;/h3&gt;

&lt;p&gt;The following code includes the Grove Sensor headers, opens the Grove Sensor, and the loops reading the temperature and humidity and writes this information to the debugger logger.&lt;/p&gt;

&lt;p&gt;Replace all the existing code in the &lt;strong&gt;main.c&lt;/strong&gt; file with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include &amp;lt;signal.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;time.h&amp;gt;
#include &amp;lt;errno.h&amp;gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#include &amp;lt;applibs/log.h&amp;gt;
#include &amp;lt;applibs/gpio.h&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// Grove Temperature and Humidity Sensor&lt;/span&gt;
&lt;span class="cp"&gt;#include "../MT3620_Grove_Shield/MT3620_Grove_Shield_Library/Grove.h"
#include "../MT3620_Grove_Shield/MT3620_Grove_Shield_Library/Sensors/GroveTempHumiSHT31.h"
&lt;/span&gt;
&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;volatile&lt;/span&gt; &lt;span class="kt"&gt;sig_atomic_t&lt;/span&gt; &lt;span class="n"&gt;terminationRequested&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;TerminationHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;signalNumber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Don't use Log_Debug here, as it is not guaranteed to be async signal safe&lt;/span&gt;
    &lt;span class="n"&gt;terminationRequested&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;argc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[])&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Log_Debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Application starting&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Register a SIGTERM handler for termination requests&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;sigaction&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;memset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;sigaction&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sa_handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TerminationHandler&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;sigaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SIGTERM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Change this GPIO number and the number in app_manifest.json if required by your hardware.&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;fd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GPIO_OpenAsOutput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO_OutputMode_PushPull&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO_Value_High&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fd&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Log_Debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;"Error opening GPIO: %s (%d). Check that app_manifest.json includes the GPIO used.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;strerror&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;errno&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;errno&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Initialize Grove Shield and Grove Temperature and Humidity Sensor&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i2cFd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;GroveShield_Initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;i2cFd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;115200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;sht31&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GroveTempHumiSHT31_Open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i2cFd&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;timespec&lt;/span&gt; &lt;span class="n"&gt;sleepTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;terminationRequested&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="n"&gt;GroveTempHumiSHT31_Read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sht31&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GroveTempHumiSHT31_GetTemperature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sht31&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;humi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GroveTempHumiSHT31_GetHumidity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sht31&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;Log_Debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Temperature: %.1fC&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;Log_Debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Humidity: %.1f\%c&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;humi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="n"&gt;GPIO_SetValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO_Value_Low&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;nanosleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;sleepTime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="n"&gt;GPIO_SetValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO_Value_High&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;nanosleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;sleepTime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Deploy the Application to the Azure Sphere
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Connect the Azure Sphere to your computer via USB&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure you have &lt;a href="https://docs.microsoft.com/en-au/azure-sphere/install/claim-device?WT.mc_id=devto-blog-dglover"&gt;claimed&lt;/a&gt;, &lt;a href="https://docs.microsoft.com/en-au/azure-sphere/install/configure-wifi?WT.mc_id=devto-blog-dglover"&gt;connected&lt;/a&gt;, and &lt;a href="https://docs.microsoft.com/en-au/azure-sphere/install/qs-blink-application?WT.mc_id=devto-blog-dglover"&gt;developer enabled&lt;/a&gt; your Azure Sphere.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;GDB Debugger (HLCore)&lt;/strong&gt; from the &lt;strong&gt;Select Startup&lt;/strong&gt; dropdown.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j84Y8G9u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-start-application.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j84Y8G9u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-start-application.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From Visual Studio, press &lt;strong&gt;F5&lt;/strong&gt; to build, deploy, start, and attached the remote debugger to the Azure Sphere.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  View the Debugger Output
&lt;/h3&gt;

&lt;p&gt;Open the &lt;em&gt;Output&lt;/em&gt; window to view the output from &lt;strong&gt;Log_Debug&lt;/strong&gt; statements in &lt;em&gt;main.c&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;You can do this by using the Visual Studio &lt;strong&gt;Ctrl+Alt+O&lt;/strong&gt; keyboard shortcut or click the &lt;strong&gt;Output&lt;/strong&gt; tab found along the bottom/right of Visual Studio.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3KCtjGwg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-view-output.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3KCtjGwg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-view-output.png" alt="Visual Studio View Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Set a Debug Breakpoint
&lt;/h3&gt;

&lt;p&gt;Set a debugger breakpoint by clicking in the margin to the left of the line of code you want the debugger to stop at.&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;main.c&lt;/strong&gt; file set a breakpoint in the margin of the line that reads the Grove temperature and pressure sensor &lt;strong&gt;GroveTempHumiSHT31_Read(sht31);&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mFRl_gND--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-set-breakpoint.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mFRl_gND--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-set-breakpoint.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Stop the Debugger
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Stop&lt;/strong&gt; the debugger by using the Visual Studio &lt;strong&gt;Shift+F5&lt;/strong&gt; keyboard shortcut or click the &lt;strong&gt;Stop Debugging&lt;/strong&gt; icon.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i1ZN3mzf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-stop-debugger.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i1ZN3mzf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/vs-stop-debugger.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Sphere Application Cloud Deployment
&lt;/h2&gt;

&lt;p&gt;Now you have learnt how to "Side Load" an application onto Azure Sphere it is time to learn about the &lt;a href=""&gt;Deployment Basics&lt;/a&gt; to &lt;em&gt;Cloud Deploy&lt;/em&gt; an application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finished 完了 fertig finito ख़त्म होना terminado
&lt;/h2&gt;

&lt;p&gt;Congratulations, you created a secure Internet of Things Azure Sphere application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9eEw63Gz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/finished.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9eEw63Gz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/finished.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Appendix
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Grove Shield Sensor Capabilities Quick Reference
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sensors&lt;/th&gt;
&lt;th&gt;Socket&lt;/th&gt;
&lt;th&gt;Capabilities&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Grove Light Sensor&lt;/td&gt;
&lt;td&gt;Analog&lt;/td&gt;
&lt;td&gt;"Gpio": [ 57, 58 ], "Uart": [ "ISU0"]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grove Rotary Sensor&lt;/td&gt;
&lt;td&gt;Analog&lt;/td&gt;
&lt;td&gt;"Gpio": [ 57, 58 ], "Uart": [ "ISU0"]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grove 4 Digit Display&lt;/td&gt;
&lt;td&gt;GPIO0 or GPIO4&lt;/td&gt;
&lt;td&gt;"Gpio": [ 0, 1 ] or "Gpio": [ 4, 5 ]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grove LED Button&lt;/td&gt;
&lt;td&gt;GPIO0 or GPIO4&lt;/td&gt;
&lt;td&gt;"Gpio": [ 0, 1 ] or "Gpio": [ 4, 5 ]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grove Oled Display 96x96&lt;/td&gt;
&lt;td&gt;I2C&lt;/td&gt;
&lt;td&gt;"Uart": [ "ISU0"]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grove Temperature Humidity SHT31&lt;/td&gt;
&lt;td&gt;I2C&lt;/td&gt;
&lt;td&gt;"Uart": [ "ISU0"]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grove UART3&lt;/td&gt;
&lt;td&gt;UART3&lt;/td&gt;
&lt;td&gt;"Uart": [ "ISU3"]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LED 1&lt;/td&gt;
&lt;td&gt;Red &lt;br&gt; Green &lt;br&gt; Blue&lt;/td&gt;
&lt;td&gt;"Gpio": [ 8 ] &lt;br&gt; "Gpio": [ 9 ] &lt;br&gt; "Gpio": [ 10 ]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LED 2&lt;/td&gt;
&lt;td&gt;Red &lt;br&gt; Green &lt;br&gt; Blue&lt;/td&gt;
&lt;td&gt;"Gpio": [ 15 ] &lt;br&gt; "Gpio": [ 16 ] &lt;br&gt; "Gpio": [ 17 ]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LED 3&lt;/td&gt;
&lt;td&gt;Red &lt;br&gt; Green &lt;br&gt; Blue&lt;/td&gt;
&lt;td&gt;"Gpio": [ 18 ] &lt;br&gt; "Gpio": [ 19 ] &lt;br&gt; "Gpio": [ 20 ]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LED 4&lt;/td&gt;
&lt;td&gt;Red &lt;br&gt; Green &lt;br&gt; Blue&lt;/td&gt;
&lt;td&gt;"Gpio": [ 21 ] &lt;br&gt; "Gpio": [ 22 ] &lt;br&gt; "Gpio": [ 23 ]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For more pin definitions see the &lt;strong&gt;mt3620_rdb.h&lt;/strong&gt; in the MT3620_Grove_Shield/MT3620_Grove_Shield_Library folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Azure Sphere Grove Kit
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Azure Sphere&lt;/th&gt;
&lt;th&gt;Image&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.seeedstudio.com/Azure-Sphere-MT3620-Development-Kit-US-Version-p-3052.html"&gt;Azure Sphere MT3620 Development Kit&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://www.seeedstudio.com/Grove-Starter-Kit-for-Azure-Sphere-MT3620-Development-Kit.html"&gt;Azure Sphere MT3620 Development Kit Shield&lt;/a&gt;. &lt;br&gt; Note, you can also purchase the parts separately.&lt;/td&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sQ923nnO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/seeed-studio-grove-shield-and-sensors.jpg" alt=""&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Azure Sphere MT3620 Developer Board Pinmap
&lt;/h3&gt;

&lt;p&gt;The full Azure Sphere MT3620 Board Pinmap can be found on the &lt;a href="https://www.seeedstudio.com/Azure-Sphere-MT3620-Development-Kit-US-Version-p-3052.html"&gt;Azure Sphere MT3620 Development Kit&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ib6UmbvG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/mt3620-dev-board-pinmap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ib6UmbvG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/Create-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit/master/resources/mt3620-dev-board-pinmap.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azuresphere</category>
      <category>visualstudio</category>
      <category>security</category>
      <category>iot</category>
    </item>
    <item>
      <title>Part 1: Build a Kubernetes "Intelligent Edge" Cluster on Raspberry Pi</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Tue, 22 Oct 2019 04:19:39 +0000</pubDate>
      <link>https://forem.com/azure/part-1-build-a-kubernetes-intelligent-edge-cluster-on-raspberry-pi-5h3k</link>
      <guid>https://forem.com/azure/part-1-build-a-kubernetes-intelligent-edge-cluster-on-raspberry-pi-5h3k</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Kubernetes-Cluster%2Fmaster%2FResources%2Frpi-kube-cluster.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Kubernetes-Cluster%2Fmaster%2FResources%2Frpi-kube-cluster.jpg" alt="Raspberry Pi Kubernetes Cluster"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow me on Twitter &lt;a href="https://twitter.com/dglover" rel="noopener noreferrer"&gt;@dglover&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Building a Kubernetes &lt;em&gt;Intelligent Edge&lt;/em&gt; cluster on Raspberry Pi is a great learning experience, a stepping stone to building robust &lt;em&gt;Intelligent Edge&lt;/em&gt; solutions, and an awesome way to impress your friends. Skills you develop on the &lt;em&gt;edge&lt;/em&gt; can be used in the &lt;em&gt;cloud&lt;/em&gt; with &lt;a href="https://azure.microsoft.com/en-au/services/kubernetes-service/?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Azure Kubernetes Service&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Kubernetes cluster is built with Raspberry Pi 4 nodes and is very capable. It has been tested with Python and C# &lt;a href="https://azure.microsoft.com/en-au/services/functions?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Azure Functions&lt;/a&gt;, &lt;a href="https://azure.microsoft.com/en-au/services/cognitive-services/custom-vision-service?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Azure Custom Vision&lt;/a&gt; Machine Learning models, and the &lt;a href="https://www.nginx.com/" rel="noopener noreferrer"&gt;NGINX&lt;/a&gt; Web Server.&lt;/p&gt;

&lt;p&gt;This project forms the basis for a four-part &lt;em&gt;Intelligence on the Edge&lt;/em&gt; series. The followup topics will include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Build, debug, and deploy Python and C# &lt;a href="https://azure.microsoft.com/en-au/services/functions?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Azure Functions&lt;/a&gt; to a Raspberry Pi Kubernetes Cluster, and learn how to access hardware from a Kubernetes managed container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Developing, deploying and managing &lt;em&gt;Intelligence on the Edge&lt;/em&gt; with &lt;a href="https://docs.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-kubernetes?WT.mc_id=devto-blog-dglover" rel="noopener noreferrer"&gt;Azure IoT Edge on Kubernetes&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Getting started with the &lt;a href="https://dapr.io?WT.mc_id=github-blog-dglover" rel="noopener noreferrer"&gt;dapr.io&lt;/a&gt;, an event-driven, portable runtime for building microservices on cloud and edge.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  System Configuration
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Kubernetes-Cluster%2Fmaster%2FResources%2Fnetwork.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FRaspberry-Pi-Kubernetes-Cluster%2Fmaster%2FResources%2Fnetwork.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Kubernetes cluster set up is fully scripted and well documented.&lt;/p&gt;

&lt;p&gt;Head to &lt;a href="https://github.com/gloveboxes/Raspberry-Pi-Kubernetes-Cluster" rel="noopener noreferrer"&gt;Building a Kubernetes &lt;em&gt;Intelligent Edge&lt;/em&gt; Cluster on Raspberry Pi&lt;/a&gt; on GitHub to learn more.&lt;/p&gt;

</description>
      <category>raspberrypi</category>
      <category>kubernetes</category>
      <category>azure</category>
      <category>msiot</category>
    </item>
    <item>
      <title>Python for Beginners Learning Series on YouTube</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Tue, 01 Oct 2019 05:44:47 +0000</pubDate>
      <link>https://forem.com/azure/python-for-beginners-learning-series-on-youtube-1mh2</link>
      <guid>https://forem.com/azure/python-for-beginners-learning-series-on-youtube-1mh2</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P3bbEjWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1zxhzwehy88agoefeskr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P3bbEjWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1zxhzwehy88agoefeskr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are starting your Python developer journey then be sure to check out the new "&lt;a href="https://www.youtube.com/playlist?list=PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6"&gt;Python for Beginners Learning Series&lt;/a&gt;" on YouTube. It's free and a great place to get started.&lt;/p&gt;

&lt;p&gt;For more information on the training series then be sure to read the "&lt;a href="https://cloudblogs.microsoft.com/opensource/2019/09/19/new-python-training-video-series-beginners?WT.mc_id=devto-blog-dglover"&gt;A new video series for beginners to learn Python programming&lt;/a&gt;" announcement on the Microsoft Open Source Blog.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Raspberry Pi, Azure IoT Central, and Docker Container Debugging</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Fri, 27 Sep 2019 08:20:19 +0000</pubDate>
      <link>https://forem.com/azure/raspberry-pi-azure-iot-central-and-docker-container-debugging-56hn</link>
      <guid>https://forem.com/azure/raspberry-pi-azure-iot-central-and-docker-container-debugging-56hn</guid>
      <description>&lt;h1&gt;
  
  
  PyLab 2: Raspberry Pi, Azure IoT Central, and Docker Container Debugging
&lt;/h1&gt;

&lt;p&gt;Follow me on Twitter &lt;a href="https://twitter.com/dglover"&gt;@dglover&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qGAWON3A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/python-loves-vscode-raspberrypi-docker.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qGAWON3A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/python-loves-vscode-raspberrypi-docker.png" alt="banner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Author&lt;/th&gt;
&lt;th&gt;
&lt;a href="https://developer.microsoft.com/en-us/advocates/dave-glover?WT.mc_id=devto-blog-dglover"&gt;Dave Glover&lt;/a&gt;, Microsoft Cloud Developer Advocate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Platforms&lt;/td&gt;
&lt;td&gt;Linux, macOS, Windows, Raspbian Buster&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Services&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/?WT.mc_id=devto-blog-dglover"&gt;Azure IoT Central&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tools&lt;/td&gt;
&lt;td&gt;&lt;a href="https://code.visualstudio.com?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hardware&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://www.raspberrypi.org/products/raspberry-pi-4-model-b/"&gt;Raspberry Pi&lt;/a&gt;, &lt;a href="https://www.raspberrypi.org/products/sense-hat/"&gt;Raspberry Pi Sense HAT&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Language&lt;/td&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date&lt;/td&gt;
&lt;td&gt;September, 2019&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  PDF Lab Guide
&lt;/h2&gt;

&lt;p&gt;You may find it easier to download and follow the PDF version of the &lt;strong&gt;Raspberry Pi, Python, Azure IoT Central, and Docker Container Debugging&lt;/strong&gt; PyLab.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/blob/master/README.pdf"&gt;English Lab Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/blob/master/PyLab-2-Raspberry-Pi-Azure-IoT-Central-and-Docker-Container-Debugging_Chinese.pdf"&gt;简体中文实验室指南&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  PyLab Content
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gloveboxes.github.io/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/"&gt;PyLab 1: Raspberry Pi, Debugging a Python Internet of Things Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gloveboxes.github.io/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/"&gt;PyLab 2: Raspberry Pi, Azure IoT Central, and Docker Container Debugging&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this hands-on lab, you will learn how to create a Python Internet of Things (IoT) application with &lt;a href="https://code.visualstudio.com/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;. Run the application  in a Docker Container on a Raspberry Pi, read temperature, humidity, and air pressure telemetry from a sensor, and finally debug the application running in the Docker Container.&lt;/p&gt;

&lt;h2&gt;
  
  
  PyLab Set Up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-0-Raspberry-Pi-Set-Up/tree/master/setup-singleuser/README.md"&gt;Single-User Set Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This automated set up installs the required libraies, Docker, and builds the lab docker images.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X1MHwK_4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/rpi3aplus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X1MHwK_4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/rpi3aplus.png" alt="Raspberry Pi with SSD"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-0-Raspberry-Pi-Set-Up/tree/master/setup-multiuser/README.md"&gt;Multi-User Set Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Multi-user set up allows up to 20 users/students per Raspberry Pi 4 4GB. A USB3 SSD drive is required to support the disk IO requirements for this number of users. The installation script installs the lab content, and Docker. Builds the lab Docker Images, and sets up all the users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d7dfW6v7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/rpi4-ssd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d7dfW6v7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/rpi4-ssd.png" alt="Raspberry Pi with SSD"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Installation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZrDNlDVK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/setup.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZrDNlDVK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/setup.jpg" alt="set up requirements"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This hands-on lab uses Visual Studio Code. Visual Studio Code is a code editor and is one of the most popular &lt;strong&gt;Open Source&lt;/strong&gt; projects on &lt;a href="https://github.com/microsoft/vscode"&gt;GitHub&lt;/a&gt;. It runs on Linux, macOS, and Windows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Visual Studio Code
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Install &lt;a href="https://code.visualstudio.com/Download?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Visual Studio Code Extensions
&lt;/h4&gt;

&lt;p&gt;The features that Visual Studio Code includes out-of-the-box are just the start. VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow.&lt;/p&gt;

&lt;h4&gt;
  
  
  Browse for extensions
&lt;/h4&gt;

&lt;p&gt;You can search and install extensions from within Visual Studio Code. Open the Extensions view from the Visual Studio Code main menu, select &lt;strong&gt;View&lt;/strong&gt; &amp;gt; &lt;strong&gt;Extensions&lt;/strong&gt; or by clicking on the Extensions icon in the &lt;strong&gt;Activity Bar&lt;/strong&gt; on the side of Visual Studio Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--czXeikuK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/extensions-view-icon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--czXeikuK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/extensions-view-icon.png" alt="Extensions view icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will show you a list of the most popular VS Code extensions on the &lt;a href="https://marketplace.visualstudio.com/VSCode?WT.mc_id=devto-blog-dglover"&gt;VS Code Marketplace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fe-qdFvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-install-extension.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fe-qdFvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-install-extension.png" alt="vs code install extension"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install the Python, Remote SSH, and Docker Extensions
&lt;/h3&gt;

&lt;p&gt;Search and install the following two Visual Studio Code Extensions published by Microsoft.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python&amp;amp;WT.mc_id=devto-blog-dglover"&gt;Python&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh&amp;amp;WT.mc_id=devto-blog-dglover"&gt;Remote - SSH&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker&amp;amp;WT.mc_id=devto-blog-dglover"&gt;Docker Extension&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Remote SSH Development
&lt;/h2&gt;

&lt;p&gt;The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of Visual Studio Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CuhSNf5Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/architecture-ssh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CuhSNf5Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/architecture-ssh.png" alt="Architecture Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Raspberry Pi Hardware
&lt;/h2&gt;

&lt;p&gt;You need the following information:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Network Address&lt;/strong&gt; of the Raspberry Pi&lt;/li&gt;
&lt;li&gt;Your Raspberry Pi &lt;strong&gt;login name&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  SSH Authentication with private/public keys
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G9zm8ibG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/ssh-login.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G9zm8ibG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/ssh-login.jpg" alt="ssh login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setting up a public/private key pair for &lt;a href="https://en.wikipedia.org/wiki/Secure_Shell"&gt;SSH&lt;/a&gt; authentication is a secure and fast way to authenticate from your computer to the Raspberry Pi. This is recommended for this hands-on lab.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSH Set up for Windows Users
&lt;/h3&gt;

&lt;p&gt;The SSH utility guides you through the process of setting up a secure SSH channel for Visual Studio Code and the Raspberry Pi.&lt;/p&gt;

&lt;p&gt;You will be prompted for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Raspberry Pi Network IP Address,&lt;/li&gt;
&lt;li&gt;The Raspberry Pi login name and password&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;From &lt;strong&gt;Windows File Explorer&lt;/strong&gt;, open &lt;strong&gt;ftp://&amp;lt;Raspberry Pi Address&amp;gt;&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SxG586EN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/windows-file-manager-address-bar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SxG586EN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/windows-file-manager-address-bar.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy the &lt;strong&gt;scripts&lt;/strong&gt; directory to your &lt;strong&gt;desktop&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dg-52eIf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/windows-file-manager.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dg-52eIf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/windows-file-manager.png" alt="Windows File Manager"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;strong&gt;scripts&lt;/strong&gt; folder you copied to your &lt;strong&gt;desktop&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Double click the &lt;strong&gt;windows-setup-ssh.cmd&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  SSH Set up for Linux and macOS Users
&lt;/h3&gt;

&lt;p&gt;The SSH utility guides you through the process of setting up a secure SSH channel for Visual Studio Code and the Raspberry Pi&lt;/p&gt;

&lt;p&gt;You will be prompted for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Raspberry Pi Network IP Address,&lt;/li&gt;
&lt;li&gt;The Raspberry Pi login name and password&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Open a Terminal window&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy and paste the following command, and press &lt;strong&gt;ENTER&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"Enter the Raspberry Pi Address: "&lt;/span&gt; pyurl &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
curl ftp://&lt;span class="nv"&gt;$pyurl&lt;/span&gt;/scripts/ssh-setup.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Start a Remote SSH Connection
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Start Visual Studio Code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;strong&gt;F1&lt;/strong&gt; to open the Command Palette, type &lt;strong&gt;ssh connect&lt;/strong&gt; and select &lt;strong&gt;Remote-SSH: Connect to Host&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;strong&gt;pylab-devnn&lt;/strong&gt; configuration&lt;/p&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HYtoSL59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-ssh-connection.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HYtoSL59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-ssh-connection.png" alt="open the ssh project"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check the Remote SSH has connected. &lt;/p&gt;

&lt;p&gt;It will take a moment to connect, then the SSH Status in the bottom lefthand corner of Visual Studio Code will change to &lt;strong&gt;&amp;gt;&amp;lt; SSH:pylab-devnn&lt;/strong&gt;.  Where devnn is your Raspberry Pi Login name.&lt;/p&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e1hs0xON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-remote-ssh-connected.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e1hs0xON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-remote-ssh-connected.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Introduction to Docker
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=YFl2mCHdv24&amp;amp;t=364s"&gt;Jake Wright's Docker in 12 Minutes&lt;/a&gt; is a great introduction to Docker.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xzze1HEV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/resources/docker_logo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xzze1HEV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/resources/docker_logo.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open the PyLab 2 Docker Debug Project
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;From Visual Studio Code main menu: &lt;strong&gt;File&lt;/strong&gt; &amp;gt; &lt;strong&gt;Open Folder&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;strong&gt;PyLab&lt;/strong&gt; directory&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Szaun0UU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-folder-PyCon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Szaun0UU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-folder-PyCon.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next select, the &lt;strong&gt;PyLab-2-Docker-Debug/&lt;/strong&gt; directory&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gclFil5T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-folder-Lab.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gclFil5T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-folder-Lab.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;OK&lt;/strong&gt; to Open the directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From the &lt;strong&gt;Explorer&lt;/strong&gt; bar, open the &lt;strong&gt;app&lt;/strong&gt; folder, then the &lt;strong&gt;app.py&lt;/strong&gt; file, and review the contents&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M3Tf6Z7s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-app-py.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M3Tf6Z7s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-open-app-py.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;



&lt;h2&gt;
  
  
  Creating an Azure IoT Central Application
&lt;/h2&gt;

&lt;p&gt;We are going to create an Azure IoT Central application, then a device, and finally a device &lt;strong&gt;connection string&lt;/strong&gt; needed for the application that will run in the Docker container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LKSz_gn0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/azure_iot_central.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LKSz_gn0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/azure_iot_central.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a New IoT Central Application
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;a href="https://azure.microsoft.com/en-au/services/iot-central/?WT.mc_id=devto-blog-dglover"&gt;Azure IoT Central&lt;/a&gt; in a new browser tab, then click &lt;strong&gt;Getting started&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next, you will need to sign with your &lt;strong&gt;Microsoft&lt;/strong&gt; Personal, or Work, or School account. If you do not have a Microsoft account, then you can create one for free using the &lt;strong&gt;Create one!&lt;/strong&gt; link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rtYvZsJU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-login.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rtYvZsJU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-login.png" alt="iot central"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new Azure IoT Central application, select &lt;strong&gt;New Application&lt;/strong&gt;. This takes you to the &lt;strong&gt;Create Application&lt;/strong&gt; page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Trail&lt;/strong&gt;, &lt;strong&gt;Custom application&lt;/strong&gt;, name your IoT Central application and complete the sign-up information.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QKKEBmJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-new-application.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QKKEBmJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-new-application.png" alt="Azure IoT Central Create Application page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Create Device Templates&lt;/strong&gt;, then select the &lt;strong&gt;Custom&lt;/strong&gt; template, name your template, for example, &lt;strong&gt;Raspberry&lt;/strong&gt;. Then click Create&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ympR0JZR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-welcome-dashboard.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ympR0JZR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-welcome-dashboard.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit the Template, add &lt;strong&gt;Measurements&lt;/strong&gt; for &lt;strong&gt;Temperature&lt;/strong&gt;, &lt;strong&gt;Humidity&lt;/strong&gt;, and &lt;strong&gt;Pressure&lt;/strong&gt; telemetry.&lt;/p&gt;

&lt;p&gt;Measurements are the data that comes from your device. You can add multiple measurements to your device template to match the capabilities of your device.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Telemetry&lt;/strong&gt; measurements are the numerical data points that your device collects over time. They're represented as a continuous stream. An example is temperature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event&lt;/strong&gt; measurements are point-in-time data that represents something of significance on the device. A severity level represents the importance of an event. An example is a fan motor error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State&lt;/strong&gt; measurements represent the state of the device or its components over a period of time. For example, a fan mode can be defined as having Operating and Stopped as the two possible states.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Location&lt;/strong&gt; measurements are the longitude and latitude coordinates of the device over a period of time in. For example, a fan can be moved from one location to another.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wq58U-G9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-new-telemetry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wq58U-G9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-new-telemetry.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the information in the following table to set up three telemetry measurements. The field name is case-sensitive.&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;must&lt;/strong&gt; click &lt;strong&gt;Save&lt;/strong&gt; after each measurement is defined.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Display Name&lt;/th&gt;
&lt;th&gt;Field name&lt;/th&gt;
&lt;th&gt;Units&lt;/th&gt;
&lt;th&gt;Minimum&lt;/th&gt;
&lt;th&gt;Maximum&lt;/th&gt;
&lt;th&gt;Decimals&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Humidity&lt;/td&gt;
&lt;td&gt;Humidity&lt;/td&gt;
&lt;td&gt;%&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Temperature&lt;/td&gt;
&lt;td&gt;Temperature&lt;/td&gt;
&lt;td&gt;degC&lt;/td&gt;
&lt;td&gt;-10&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pressure&lt;/td&gt;
&lt;td&gt;Pressure&lt;/td&gt;
&lt;td&gt;hPa&lt;/td&gt;
&lt;td&gt;800&lt;/td&gt;
&lt;td&gt;1260&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The following is an example of setting up the &lt;strong&gt;Temperature&lt;/strong&gt; telemetry measurement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QZuJTU5I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-create-new-telemetry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QZuJTU5I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-create-new-telemetry.png" alt="new measurement"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Device&lt;/strong&gt; on the sidebar menu, select the &lt;strong&gt;Raspberry&lt;/strong&gt; template you created.&lt;/p&gt;

&lt;p&gt;IoT central supports real devices, such as the Raspberry Pi used for this lab, as well as simulated devices which generate random data  useful for system testing.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select &lt;strong&gt;Real&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z5XW2B3j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-add-real-device.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z5XW2B3j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-add-real-device.png" alt="create a real device"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Name your &lt;strong&gt;Device ID&lt;/strong&gt; so you can easily identify the device in the IoT Central portal, then click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLvGkYv3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-create-new-device.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLvGkYv3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-create-new-device.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When you have created your real device click the &lt;strong&gt;Connect&lt;/strong&gt; button in the top right-hand corner of the screen to display the device credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g55seP0z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-connect-device.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g55seP0z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-connect-device.png" alt="connect device"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leave this page open as you will need this connection information for the next step in the hands-on lab.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OTn_sj7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-device-connection.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OTn_sj7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-device-connection.png" alt="Device Connection"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Generate an Azure IoT Hub Connection String
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Hold the control key down and click the following link &lt;a href="https://dpsgen.z8.web.core.windows.net/"&gt;Connection String Generator&lt;/a&gt; to open in a new tab.&lt;/p&gt;

&lt;p&gt;Copy and paste the &lt;strong&gt;Scope Id&lt;/strong&gt;, &lt;strong&gt;Device Id&lt;/strong&gt;, and the &lt;strong&gt;Primary Key&lt;/strong&gt; from the Azure IoT Central Device Connection panel to the Connection String Generator page and click &lt;strong&gt;Get Connection String&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1B5ARKIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-connection-string-generator-example.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1B5ARKIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-connection-string-generator-example.png" alt="connection string example"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the generated connection string to the clipboard as you will need it for the next step.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Configure the Python Application
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Switch back to Visual Studio Code. Open the &lt;strong&gt;env-file&lt;/strong&gt; (environment file). This file contains environment variables that will be passed to the Docker container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Paste the connection string you copied in the previous step into the env-file on the same line, and after  &lt;strong&gt;CONNECTION_STRING=&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CONNECTION_STRING=HostName=saas-iothub-8135cd3b....
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save the env-file file (Ctrl+S)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Build and Run the Docker Image
&lt;/h3&gt;

&lt;p&gt;Press &lt;strong&gt;F5&lt;/strong&gt; to start debugging the Python application. The process will first build and then start the Docker Container. When the Docker Container has started the Visual Studio Code Debugger will attach to the running application.&lt;/p&gt;

&lt;p&gt;There are two configuration files found in the .vscode folder that are responsible for running and debugging the Python application. You can find more detail the Debugger Configuration appendix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set a Visual Studio Debugger Breakpoint
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;From &lt;strong&gt;Explorer&lt;/strong&gt; on the Visual Studio Code activity bar, open the &lt;strong&gt;app.py&lt;/strong&gt; file&lt;/li&gt;
&lt;li&gt;Set a breakpoint at line 66, &lt;strong&gt;temperature, pressure, humidity, timestamp = mysensor.measure()&lt;/strong&gt; in the &lt;strong&gt;publish&lt;/strong&gt; function.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can set a breakpoint by doing any one of the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With the cursor on that line, press F9, or,&lt;/li&gt;
&lt;li&gt;With the cursor on that line, select the Debug &amp;gt; Toggle Breakpoint menu command, or, click directly in the margin to the left of the line number (a faded red dot appears when hovering there). The breakpoint appears as a red dot in the left margin:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WG6Qn6JC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-set-breakpoint.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WG6Qn6JC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-set-breakpoint.png" alt="Attached debugger"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Debug actions
&lt;/h3&gt;

&lt;p&gt;Once a debug session starts, the &lt;strong&gt;Debug toolbar&lt;/strong&gt; will appear at the top of the editor window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4zEEnz4n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/toolbar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4zEEnz4n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/toolbar.png" alt="Debug Actions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The debugger toolbar (shown above) will appear in Visual Studio Code. It has the following options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pause (or Continue, F5),&lt;/li&gt;
&lt;li&gt;Step Over (F10)&lt;/li&gt;
&lt;li&gt;Step Into (F11),&lt;/li&gt;
&lt;li&gt;Step Out (Shift+F11),&lt;/li&gt;
&lt;li&gt;Restart (Ctrl+Shift+F5),&lt;/li&gt;
&lt;li&gt;and Stop (Shift+F5).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step through the Python code
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;strong&gt;F10&lt;/strong&gt;, or from the Debugger Toolbar, click &lt;strong&gt;Step Over&lt;/strong&gt; until you are past the &lt;strong&gt;print(telemetry)&lt;/strong&gt; line of code.&lt;/li&gt;
&lt;li&gt;Explore the &lt;strong&gt;Variable Window&lt;/strong&gt; (Ctrl+Shift+Y). Try changing variable values.&lt;/li&gt;
&lt;li&gt;Explore the &lt;strong&gt;Debug Console&lt;/strong&gt;. You will see sensor telemetry and the results of sending the telemetry to Azure IoT Central.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ybTJGka7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/vs-code-debug-console.png" alt="vs code debug console"&gt;
&lt;/li&gt;
&lt;li&gt;From the &lt;strong&gt;Debug&lt;/strong&gt; Menu -&amp;gt; &lt;strong&gt;Disable All Breakpoints&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;F5&lt;/strong&gt; or from the Debugger Toolbar, click &lt;strong&gt;Continue&lt;/strong&gt; so the Python application runs and streams telemetry to &lt;strong&gt;Azure IoT Central&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Exploring Device Telemetry in Azure IoT Central
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;strong&gt;Device&lt;/strong&gt; to navigate to the &lt;strong&gt;Measurements&lt;/strong&gt; page for the real Raspberry Pi device you added:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HXr37HcD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-select-device.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HXr37HcD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-select-device.png" alt="Navigate to real device"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On the &lt;strong&gt;Measurements&lt;/strong&gt; page, you can see the telemetry streaming from the Raspberry Pi device:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EQwkykqa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-view-telemetry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EQwkykqa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/iot-central-view-telemetry.png" alt="View telemetry from real device"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Finished
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WJZ1bDEQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/finished.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WJZ1bDEQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/resources/finished.jpg" alt="finished"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Appendix
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Debugger Configuration
&lt;/h3&gt;

&lt;p&gt;There are two files (launch.json and tasks.json) found in the .vscode folder that are responsible for the running and debugging the application.&lt;/p&gt;

&lt;h4&gt;
  
  
  Launch Configuration
&lt;/h4&gt;

&lt;p&gt;Creating a launch configuration file is useful as it allows you to configure and save debugging setup details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;launch.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IntelliSense&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;learn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;possible&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;attributes.&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Hover&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;view&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;descriptions&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;existing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;attributes.&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;For&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;more&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;information&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;visit:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;https://go.microsoft.com/fwlink/?linkid=&lt;/span&gt;&lt;span class="mi"&gt;830387&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"configurations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Attach Debugger"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"preLaunchTask"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"start-docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"postDebugTask"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stop-docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"attach"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"pathMappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"localRoot"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceRoot}/app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"remoteRoot"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/app"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${env:LAB_PORT}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"host"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"localhost"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Stop Container"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"preLaunchTask"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stop-docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"launch"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Tasks Configuration
&lt;/h4&gt;

&lt;p&gt;Tasks integrate external tools to automate build cycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tasks.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;See&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;https://go.microsoft.com/fwlink/?LinkId=&lt;/span&gt;&lt;span class="mi"&gt;733558&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;documentation&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;tasks.json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;format&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"tasks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"start-docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"-c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;docker build -t $USER:latest . ;docker run -d -p $LAB_PORT:3000 -e TELEMETRY_HOST=$LAB_HOST --env-file env-file --name $USER --rm  $USER:latest; sleep 1 &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;container&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;background&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;container&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;maps&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;$LAB_PORT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;port&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;container&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;port&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;used&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;debugging&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-e&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Environment&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Variable.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;The&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IP&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Address&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;telemetry&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;service.&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;--env-file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;reads&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;sets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Environment&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Variables&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;--name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;names&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Container&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;--rm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;removes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;container&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;when&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;you&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;stop&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;it&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;reference&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;https://docs.docker.com/engine/reference/run/&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stop-docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"-c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;docker stop $USER&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Azure IoT Central
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Take a tour of the Azure IoT Central UI
&lt;/h4&gt;

&lt;p&gt;This article introduces you to the Microsoft Azure IoT Central UI. You can use the UI to create, manage, and use an Azure IoT Central solution and its connected devices.&lt;/p&gt;

&lt;p&gt;As a &lt;em&gt;builder&lt;/em&gt;, you use the Azure IoT Central UI to define your Azure IoT Central solution. You can use the UI to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define the types of device that connect to your solution.&lt;/li&gt;
&lt;li&gt;Configure the rules and actions for your devices.&lt;/li&gt;
&lt;li&gt;Customize the UI for an &lt;em&gt;operator&lt;/em&gt; who uses your solution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As an &lt;em&gt;operator&lt;/em&gt;, you use the Azure IoT Central UI to manage your Azure IoT Central solution. You can use the UI to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitor your devices.&lt;/li&gt;
&lt;li&gt;Configure your devices.&lt;/li&gt;
&lt;li&gt;Troubleshoot and remediate issues with your devices.&lt;/li&gt;
&lt;li&gt;Provision new devices.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Use the left navigation menu
&lt;/h4&gt;

&lt;p&gt;Use the left navigation menu to access the different areas of the application. You can expand or collapse the navigation bar by selecting &lt;strong&gt;&amp;lt;&lt;/strong&gt; or &lt;strong&gt;&amp;gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2Yx1oNj9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/navigationbar-description.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2Yx1oNj9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/navigationbar-description.png" alt="Left navigation menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Search, help, and support
&lt;/h4&gt;

&lt;p&gt;The top menu appears on every page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--glBcJKyR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/toolbar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--glBcJKyR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/toolbar.png" alt="Toolbar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To search for device templates and devices, enter a &lt;strong&gt;Search&lt;/strong&gt; value.&lt;/li&gt;
&lt;li&gt;To change the UI language or theme, choose the &lt;strong&gt;Settings&lt;/strong&gt; icon.&lt;/li&gt;
&lt;li&gt;To sign out of the application, choose the &lt;strong&gt;Account&lt;/strong&gt; icon.&lt;/li&gt;
&lt;li&gt;To get help and support, choose the &lt;strong&gt;Help&lt;/strong&gt; drop-down for a list of resources. In a trial application, the support resources include access to &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-show-hide-chat?WT.mc_id=devto-blog-dglover"&gt;live chat&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can choose between a light theme or a dark theme for the UI:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c92e41_D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/themes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c92e41_D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/themes.png" alt="Choose a theme for the UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Dashboard
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1Uk1zjmS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/homepage.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1Uk1zjmS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/homepage.png" alt="Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The dashboard is the first page you see when you sign in to your Azure IoT Central application. As a builder, you can customize the application dashboard for other users by adding tiles. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/tutorial-customize-operator?WT.mc_id=devto-blog-dglover"&gt;Customize the Azure IoT Central operator's view&lt;/a&gt; tutorial. Users can also &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-personalize-dashboard?WT.mc_id=devto-blog-dglover"&gt;create their own personal dashboards&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Device explorer
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TiIRsncW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/explorer.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TiIRsncW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/explorer.png" alt="Explorer page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The explorer page shows the &lt;em&gt;devices&lt;/em&gt; in your Azure IoT Central application grouped by &lt;em&gt;device template&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A device template defines a type of device that can connect to your application. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/tutorial-define-device-type?WT.mc_id=devto-blog-dglover"&gt;Define a new device type in your Azure IoT Central application&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A device represents either a real or simulated device in your application. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/tutorial-add-device?WT.mc_id=devto-blog-dglover"&gt;Add a new device to your Azure IoT Central application&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Device sets
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A_-fvQBg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/devicesets.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A_-fvQBg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/devicesets.png" alt="Device Sets page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;device sets&lt;/em&gt; page shows device sets created by the builder. A device set is a collection of related devices. A builder defines a query to identify the devices that are included in a device set. You use device sets when you customize the analytics in your application. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-use-device-sets?WT.mc_id=devto-blog-dglover"&gt;Use device sets in your Azure IoT Central application&lt;/a&gt; article.&lt;/p&gt;

&lt;h4&gt;
  
  
  Device Templates
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y1Th5usD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/templates.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y1Th5usD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/templates.png" alt="Device Templates page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The device templates page is where a builder creates and manages the device templates in the application. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/tutorial-define-device-type?WT.mc_id=devto-blog-dglover"&gt;Define a new device type in your Azure IoT Central application&lt;/a&gt; tutorial.&lt;/p&gt;

&lt;h4&gt;
  
  
  Analytics
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yvAEmm0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/analytics.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yvAEmm0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/analytics.png" alt="Analytics page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The analytics page shows charts that help you understand how the devices connected to your application are behaving. An operator uses this page to monitor and investigate issues with connected devices. The builder can define the charts shown on this page. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-use-device-sets?WT.mc_id=devto-blog-dglover"&gt;Create custom analytics for your Azure IoT Central application&lt;/a&gt; article.&lt;/p&gt;

&lt;h4&gt;
  
  
  Jobs
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5HTd1zMk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/jobs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5HTd1zMk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/jobs.png" alt="Jobs page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The jobs page allows you to perform bulk device management operations onto your devices. The builder uses this page to update device properties, settings, and commands. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-run-a-job?WT.mc_id=devto-blog-dglover"&gt;Run a job&lt;/a&gt; article.&lt;/p&gt;

&lt;h4&gt;
  
  
  Continuous Data Export
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1M5dJyvC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/export.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1M5dJyvC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/export.png" alt="Continuous Data Export page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The continuous data export page is where an administrator defines how to export data, such as telemetry, from the application. Other services can store the exported data or use it for analysis. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-export-data?WT.mc_id=devto-blog-dglover"&gt;Export your data in Azure IoT Central&lt;/a&gt; article.&lt;/p&gt;

&lt;h4&gt;
  
  
  Administration
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rUkQbkOT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/administration.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rUkQbkOT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/master/media/overview-iot-central-tour/administration.png" alt="Administration page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The administration page contains links to the tools an administrator uses such as defining users and roles in the application. To learn more, see the &lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/howto-administer?WT.mc_id=devto-blog-dglover"&gt;Administer your Azure IoT Central application&lt;/a&gt; article.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://azure.microsoft.com/en-au/services/iot-central?WT.mc_id=devto-blog-dglover"&gt;Azure IoT Central&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/azure/azure-iot-edge-on-raspberry-pi-buster-plus-tips-for-raspberry-pi-4-22nn"&gt;Installing Docker on Raspberry Pi Buster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=YFl2mCHdv24&amp;amp;t=358s"&gt;Understanding Docker in 12 Minutes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>raspberrypi</category>
      <category>iot</category>
      <category>python</category>
      <category>docker</category>
    </item>
    <item>
      <title>Raspberry Pi, Debugging a Python Internet of Things Application</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Fri, 27 Sep 2019 08:05:56 +0000</pubDate>
      <link>https://forem.com/azure/raspberry-pi-debugging-a-python-internet-of-things-application-2e2c</link>
      <guid>https://forem.com/azure/raspberry-pi-debugging-a-python-internet-of-things-application-2e2c</guid>
      <description>&lt;h1&gt;
  
  
  PyLab 1: Raspberry Pi, Debugging a Python Internet of Things Application
&lt;/h1&gt;

&lt;p&gt;Follow me on Twitter &lt;a href="https://twitter.com/dglover"&gt;@dglover&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5FvBLi3C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/python-loves-vscode-raspberrypi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5FvBLi3C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/python-loves-vscode-raspberrypi.jpg" alt="banner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Author&lt;/th&gt;
&lt;th&gt;
&lt;a href="https://developer.microsoft.com/en-us/advocates/dave-glover?WT.mc_id=devto-blog-dglover"&gt;Dave Glover&lt;/a&gt;, Microsoft Cloud Developer Advocate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Platforms&lt;/td&gt;
&lt;td&gt;Linux, macOS, Windows, Raspbian Buster&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Services&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/iot-central/?WT.mc_id=devto-blog-dglover"&gt;Azure IoT Central&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tools&lt;/td&gt;
&lt;td&gt;&lt;a href="https://code.visualstudio.com?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hardware&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://www.raspberrypi.org/products/raspberry-pi-4-model-b/"&gt;Raspberry Pi&lt;/a&gt;, &lt;a href="https://www.raspberrypi.org/products/sense-hat/"&gt;Raspberry Pi Sense HAT&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Language&lt;/td&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date&lt;/td&gt;
&lt;td&gt;September, 2019&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  PDF Lab Guide
&lt;/h2&gt;

&lt;p&gt;You may find it easier to download and follow the PDF version of the &lt;strong&gt;Debugging Raspberry Pi Internet of Things Flask App&lt;/strong&gt; PyLab.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/blob/master/README.pdf"&gt;English Lab Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/blob/master/PyLab-1-Raspberry-Pi-Debugging-a-Python-Internet-of-Things-Application_Chinese.pdf"&gt;简体中文实验室指南&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  PyLab Content
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gloveboxes.github.io/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/"&gt;PyLab 1: Raspberry Pi, Debugging a Python Internet of Things Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gloveboxes.github.io/PyLab-2-Python-Azure-IoT-Central-and-Docker-Container-Debugging/"&gt;PyLab 2: Raspberry Pi, Azure IoT Central, and Docker Container Debugging&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this hands-on lab, you will learn how to create and debug a Python web application on a Raspberry Pi with &lt;a href="https://code.visualstudio.com/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt; and the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh&amp;amp;WT.mc_id=devto-blog-dglover"&gt;Remote SSH&lt;/a&gt; extension. The web app will read the temperature, humidity, and air pressure telemetry from a sensor connected to the Raspberry Pi.&lt;/p&gt;

&lt;h2&gt;
  
  
  PyLab Set Up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-0-Raspberry-Pi-Set-Up/tree/master/setup-singleuser/README.md"&gt;Single-User Set Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This automated set up installs the required libraies, Docker, and builds the lab docker images.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NduFVCeu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/rpi3aplus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NduFVCeu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/rpi3aplus.png" alt="Raspberry Pi with SSD"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/PyLab-0-Raspberry-Pi-Set-Up/tree/master/setup-multiuser/README.md"&gt;Multi-User Set Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Multi-user set up allows up to 20 users/students per Raspberry Pi 4 4GB. A USB3 SSD drive is required to support the disk IO requirements for this number of users. The installation script installs the lab content, and Docker. Builds the lab Docker Images, and sets up all the users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mlHfS5pD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/rpi4-ssd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mlHfS5pD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/rpi4-ssd.png" alt="Raspberry Pi with SSD"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Installation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--62d0nqPC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/setup.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--62d0nqPC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/setup.jpg" alt="set up requirements"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This hands-on lab uses Visual Studio Code. Visual Studio Code is a code editor and is one of the most popular &lt;strong&gt;Open Source&lt;/strong&gt; projects on &lt;a href="https://github.com/microsoft/vscode"&gt;GitHub&lt;/a&gt;. It runs on Linux, macOS, and Windows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Visual Studio Code
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Install &lt;a href="https://code.visualstudio.com/Download?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Visual Studio Code Extensions
&lt;/h4&gt;

&lt;p&gt;The features that Visual Studio Code includes out-of-the-box are just the start. VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow.&lt;/p&gt;

&lt;h4&gt;
  
  
  Browse for extensions
&lt;/h4&gt;

&lt;p&gt;You can search and install extensions from within Visual Studio Code. Open the Extensions view from the Visual Studio Code main menu, select &lt;strong&gt;View&lt;/strong&gt; &amp;gt; &lt;strong&gt;Extensions&lt;/strong&gt; or by clicking on the Extensions icon in the &lt;strong&gt;Activity Bar&lt;/strong&gt; on the side of Visual Studio Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ga-1BlWL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/extensions-view-icon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ga-1BlWL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/extensions-view-icon.png" alt="Extensions view icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will show you a list of the most popular VS Code extensions on the &lt;a href="https://marketplace.visualstudio.com/VSCode?WT.mc_id=devto-blog-dglover"&gt;VS Code Marketplace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tl5tJP1T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-install-extension.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tl5tJP1T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-install-extension.png" alt="vs code install extension"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install the Python and Remote SSH Extensions
&lt;/h3&gt;

&lt;p&gt;Search and install the following two Visual Studio Code Extensions published by Microsoft.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python&amp;amp;WT.mc_id=devto-blog-dglover"&gt;Python&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh&amp;amp;WT.mc_id=devto-blog-dglover"&gt;Remote - SSH&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Remote SSH Development
&lt;/h2&gt;

&lt;p&gt;The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of Visual Studio Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OJSR_97q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/architecture-ssh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OJSR_97q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/architecture-ssh.png" alt="Architecture Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Raspberry Pi Hardware
&lt;/h2&gt;

&lt;p&gt;If you are attending a workshop, then you can use a shared network-connected Raspberry Pi. You can also use your own network-connected Raspberry Pi for this hands-on lab.&lt;/p&gt;

&lt;p&gt;You will need the following information from the lab instructor.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Network IP Address&lt;/strong&gt; of the Raspberry Pi&lt;/li&gt;
&lt;li&gt;Your assigned &lt;strong&gt;login name&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  SSH Authentication with private/public keys
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WCymvJhh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/ssh-login.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WCymvJhh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/ssh-login.jpg" alt="ssh login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setting up a public/private key pair for &lt;a href="https://en.wikipedia.org/wiki/Secure_Shell"&gt;SSH&lt;/a&gt; authentication is a secure and fast way to authenticate from your computer to the Raspberry Pi. This is recommended for this hands-on lab.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSH Set up for Windows Users
&lt;/h3&gt;

&lt;p&gt;The SSH utility guides you through the process of setting up a secure SSH channel for Visual Studio Code and the Raspberry Pi.&lt;/p&gt;

&lt;p&gt;You will be prompted for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Raspberry Pi Network IP Address,&lt;/li&gt;
&lt;li&gt;The Raspberry Pi login name and password&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;From &lt;strong&gt;Windows File Explorer&lt;/strong&gt;, open &lt;strong&gt;ftp://&amp;lt;Raspberry Pi Address&amp;gt;&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x4ammRAJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/windows-file-manager-address-bar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x4ammRAJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/windows-file-manager-address-bar.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy the &lt;strong&gt;scripts&lt;/strong&gt; directory to your &lt;strong&gt;desktop&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dVjbdg1P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/windows-file-manager.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dVjbdg1P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/windows-file-manager.png" alt="Windows File Manager"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;strong&gt;scripts&lt;/strong&gt; folder you copied to your &lt;strong&gt;desktop&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Double click the &lt;strong&gt;windows-setup-ssh.cmd&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  SSH Set up for Linux and macOS Users
&lt;/h3&gt;

&lt;p&gt;The SSH utility guides you through the process of setting up a secure SSH channel for Visual Studio Code and the Raspberry Pi&lt;/p&gt;

&lt;p&gt;You will be prompted for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Raspberry Pi Network IP Address,&lt;/li&gt;
&lt;li&gt;The Raspberry Pi login name and password&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Open a Terminal window&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy and paste the following command, and press &lt;strong&gt;ENTER&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"Enter the Raspberry Pi Address: "&lt;/span&gt; pyurl &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
curl ftp://&lt;span class="nv"&gt;$pyurl&lt;/span&gt;/scripts/ssh-setup.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Start a Remote SSH Connection
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Start Visual Studio Code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;strong&gt;F1&lt;/strong&gt; to open the Command Palette, type &lt;strong&gt;ssh connect&lt;/strong&gt; and select &lt;strong&gt;Remote-SSH: Connect to Host&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;strong&gt;pylab-devnn&lt;/strong&gt; configuration&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Jvd68oNI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-ssh-connection.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jvd68oNI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-ssh-connection.png" alt="open the ssh project"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check the Remote SSH has connected.&lt;/p&gt;

&lt;p&gt;It will take a moment to connect, then the SSH Status in the bottom lefthand corner of Visual Studio Code will change to &lt;strong&gt;&amp;gt;&amp;lt; SSH:pylab-devnn&lt;/strong&gt;.  Where devnn is your Raspberry Pi Login name.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VToVu7v6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-remote-ssh-connected.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VToVu7v6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-remote-ssh-connected.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Open PyLab 1 Python Debug Project
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Python Flask Web Apps
&lt;/h3&gt;

&lt;p&gt;In this lab, we are going to start and debug a &lt;a href="https://www.fullstackpython.com/flask.html"&gt;Flask&lt;/a&gt; app that reads a sensor attached to the Raspberry Pi. Flask is a popular Python Web Framework, powerful, but also easy for beginners.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;From Visual Studio Code main menu: &lt;strong&gt;File&lt;/strong&gt; &amp;gt; &lt;strong&gt;Open Folder&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;strong&gt;PyLab&lt;/strong&gt; directory&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OGZvOZ19--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-folder-PyCon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OGZvOZ19--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-folder-PyCon.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next select, the &lt;strong&gt;PyLab-1-Python-Debug&lt;/strong&gt; directory&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F42wP1-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-folder-Lab.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F42wP1-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-folder-Lab.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;OK&lt;/strong&gt; to Open the directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From the &lt;strong&gt;Explorer&lt;/strong&gt; bar, open the &lt;strong&gt;app.py&lt;/strong&gt; file and review the contents&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2DRDs_ln--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-appy-py.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2DRDs_ln--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-appy-py.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;



&lt;p&gt;Take a moment to review the Python Flask web app.&lt;/p&gt;

&lt;h4&gt;
  
  
  app&lt;span&gt;&lt;/span&gt;.py
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;telemetry_client&lt;/span&gt;
&lt;span class="c1"&gt;# import sensor_bme280
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;time&lt;/span&gt;

&lt;span class="c1"&gt;# myTelemetry = sensor_bme280.Telemetry()
&lt;/span&gt;&lt;span class="n"&gt;myTelemetry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;telemetry_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Telemetry&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;show_telemetry&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;

    &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;formatted_now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%A, %d %B, %Y at %X"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Raspberry Pi Environment Data"&lt;/span&gt;

    &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pressure&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;humidity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cpu_temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;myTelemetry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;measure&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;sensor_updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s"&gt;"%A, %d %B, %Y at %X"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;localtime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;pressure&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1500&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;humidity&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'index.html'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                            &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pressure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;pressure&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                            &lt;span class="n"&gt;humidity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;humidity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cputemperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cpu_temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Start the Python Flask App
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;strong&gt;F5&lt;/strong&gt; to start the Python Flask app.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From the Visual Studio Code &lt;strong&gt;Terminal Window&lt;/strong&gt;, click the &lt;strong&gt;running on http://...&lt;/strong&gt; web link.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2rMiGt8G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-start-web-browser.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2rMiGt8G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-start-web-browser.png" alt="Open web browser from VS Code"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This will launch your desktop Web Browser.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-  The Flask app will read the temperature, air pressure, humidity from the &lt;strong&gt;sensor&lt;/strong&gt; attached the Raspberry Pi and display the results in your web browser.&lt;br&gt;
&amp;lt;br/&amp;gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MXF6ELDW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/flask-web-page.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MXF6ELDW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/flask-web-page.png" alt="Flask Web Page"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Debugging with Breakpoints&lt;br&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Switch back to Visual Studio Code and ensure the &lt;strong&gt;app.py&lt;/strong&gt; file is open.&lt;/li&gt;
&lt;li&gt;Put the cursor on the line that reads &lt;strong&gt;now = datetime.now()&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;strong&gt;F9&lt;/strong&gt; to set a breakpoint. A red dot will appear on the line to indicate a breakpoint has been set.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GK0Gfwmo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-flask-app.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GK0Gfwmo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-flask-app.png" alt="Start the flask web application"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch back to the &lt;strong&gt;Web Browser&lt;/strong&gt; and click &lt;strong&gt;Refresh&lt;/strong&gt;. The web page will &lt;strong&gt;not respond&lt;/strong&gt; as the debugger has stopped at the breakpoint you set.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Switch back to &lt;strong&gt;Visual Studio Code&lt;/strong&gt;. You will see that the code has stopped running at the &lt;strong&gt;breakpoint&lt;/strong&gt;.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tWBO86NT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-stop-at-breakpoint.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tWBO86NT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-stop-at-breakpoint.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Debugger Toolbar Options
&lt;/h2&gt;

&lt;p&gt;When a debug session starts, the &lt;strong&gt;Debug toolbar&lt;/strong&gt; will appear at the top of the editor window.&lt;/p&gt;

&lt;p&gt;The debugging toolbar (shown below) will appear in Visual Studio Code. It has the following options:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4RgdgCbw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/toolbar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4RgdgCbw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/toolbar.png" alt="Debug Actions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pause (or Continue, F5),&lt;/li&gt;
&lt;li&gt;Step Over (F10)&lt;/li&gt;
&lt;li&gt;Step Into (F11),&lt;/li&gt;
&lt;li&gt;Step Out (Shift+F11),&lt;/li&gt;
&lt;li&gt;Restart (Ctrl+Shift+F5),&lt;/li&gt;
&lt;li&gt;and Stop (Shift+F5).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Start Debugging
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Step through the code by pressing (&lt;strong&gt;F10&lt;/strong&gt;) or clicking &lt;strong&gt;Step Over&lt;/strong&gt; on the debugging toolbar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeat&lt;/strong&gt; pressing &lt;strong&gt;F10&lt;/strong&gt; until you reach the line that reads &lt;strong&gt;if -40 &amp;lt;= temperature &amp;lt;= 60 and 0 &amp;lt;= pressure &amp;lt;= 1500 and 0 &amp;lt;= humidity &amp;lt;= 100:&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You will notice that Python variables are displayed in the &lt;strong&gt;Variables Window&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If the Variable Window is not visible click &lt;strong&gt;Debug&lt;/strong&gt; in the activity bar.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5C675rxW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-activity-bar-debug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5C675rxW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-activity-bar-debug.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tDI3yn2_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-stepping-code-variable-window.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tDI3yn2_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-stepping-code-variable-window.png" alt="Variable window"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try to change the &lt;strong&gt;temperature&lt;/strong&gt; variable to &lt;strong&gt;50&lt;/strong&gt;. Hint, &lt;strong&gt;right mouse&lt;/strong&gt; click on the temperature variable and select &lt;strong&gt;Set Value&lt;/strong&gt;, or double click on a &lt;strong&gt;temperature&lt;/strong&gt; variable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;strong&gt;F5&lt;/strong&gt; to resume the Flask App, then &lt;strong&gt;switch back to your web browser&lt;/strong&gt; and you will see the temperature, humidity, and pressure Sensor data displayed on the web page.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Debugging with Conditional Breakpoints
&lt;/h3&gt;

&lt;p&gt;Try setting a &lt;strong&gt;conditional&lt;/strong&gt; breakpoint&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clear the existing breakpoints. From the main menu select &lt;strong&gt;Debug&lt;/strong&gt; &amp;gt; &lt;strong&gt;Remove all breakpoints&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Ensure the &lt;strong&gt;app.py&lt;/strong&gt; file open.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Right mouse click&lt;/strong&gt; directly in the margin to the &lt;strong&gt;left&lt;/strong&gt; of the line number &lt;strong&gt;22&lt;/strong&gt;.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KdgZ3YMU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-add-conditional-breakpoint.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KdgZ3YMU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-add-conditional-breakpoint.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Add Conditional Breakpoint...&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set the condition to &lt;strong&gt;temperature &amp;gt; 25&lt;/strong&gt;, then press &lt;strong&gt;ENTER&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3kj7Ccd4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-conditional-breakpoint.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3kj7Ccd4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-conditional-breakpoint.png" alt="Conditional BreakPoint in Visual Studio Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The breakpoint appears as a red dot with an equals sign in the middle&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch back to the &lt;strong&gt;Web Browser&lt;/strong&gt; and click &lt;strong&gt;Refresh&lt;/strong&gt;. The web page will &lt;strong&gt;not respond&lt;/strong&gt; as the debugger has stopped at the breakpoint you set.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Switch&lt;/strong&gt; back to &lt;strong&gt;Visual Studio Code&lt;/strong&gt; and you will see the debugger has stopped at the &lt;strong&gt;conditional breakpoint&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;strong&gt;F5&lt;/strong&gt; to continue running the code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Switch&lt;/strong&gt; back to your &lt;strong&gt;web browser&lt;/strong&gt; to view the page.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Interactive Debug Console
&lt;/h2&gt;

&lt;p&gt;The Visual Studio Code &lt;strong&gt;Debug Console&lt;/strong&gt; will give you access to the &lt;a href="https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop"&gt;Python REPL&lt;/a&gt; (Read, Evaluate, Print Loop).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Switch&lt;/strong&gt; back to your &lt;strong&gt;web browser&lt;/strong&gt; and click refresh. The web page will &lt;strong&gt;not respond&lt;/strong&gt; as the Python code has been stopped by the debugger.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switch&lt;/strong&gt; back to &lt;strong&gt;Visual Studio Code&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The code will have stopped at the conditional breakpoint you previously set.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the Visual Studio &lt;strong&gt;Debug Console&lt;/strong&gt; window.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D9e1cwOg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-debug-console-print.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D9e1cwOg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-debug-console-print.png" alt="visual studio debug console"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Type the following Python code into the Input Prompt &lt;strong&gt;&amp;gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;strong&gt;Enter&lt;/strong&gt; to execute the Python code you typed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Try running the following Python code snippets from the input prompt.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;random&lt;/span&gt;
&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;randrange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;strong&gt;F5&lt;/strong&gt; to continue the execution of the Python code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch back to you web browser to see the updated page.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Lab Challenges
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Lab Challenge 1: Update the Flask Template
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Update the Flask &lt;strong&gt;index.html&lt;/strong&gt; template found in the &lt;strong&gt;templates&lt;/strong&gt; folder to display the current date and time.&lt;/li&gt;
&lt;li&gt;Rerun the Flask app.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Lab Challenge 2: Experiment with Debugger Options
&lt;/h3&gt;

&lt;p&gt;Things to try:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Review the &lt;a href="https://code.visualstudio.com/docs/python/python-tutorial?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code Python Tutorial&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Review the &lt;a href="https://vscode-westeu.azurewebsites.net/docs/python/tutorial-flask"&gt;Python Flask tutorial&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Review the &lt;a href="https://code.visualstudio.com/docs/editor/debugging?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code Debugging Tutorial&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Review the Debug &lt;strong&gt;Launch&lt;/strong&gt; Settings
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Switch to Debug view in Visual Studio Code (using the left-side activity bar).&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1sZtQl_c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-launch-json.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1sZtQl_c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-open-launch-json.png" alt="open launch json file"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Settings&lt;/strong&gt; button which will open the &lt;strong&gt;launch.json&lt;/strong&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;launch.json&lt;/strong&gt; file defines how the Flask app will start, and what &lt;a href="https://flask.palletsprojects.com/en/1.0.x/cli/"&gt;Flask Command Line&lt;/a&gt; parameters to pass at startup.&lt;/p&gt;

&lt;p&gt;There are two environment variables used in the launch.json file. These are &lt;strong&gt;LAB_HOST&lt;/strong&gt; (which is the IP Address of the Raspberry Pi), and &lt;strong&gt;LAB_PORT&lt;/strong&gt; (a random TCP/IP Port number between 5000 and 8000). These environment variables are set by the .bashrc script which runs when you connect to the Raspberry Pi with Visual Studio Remote SSH.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Closing the Remote SSH Session
&lt;/h2&gt;

&lt;p&gt;From Visual Studio Code, &lt;strong&gt;Close Remote Connection&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Remote SSH&lt;/strong&gt; button in the &lt;strong&gt;bottom left-hand corner&lt;/strong&gt; and select &lt;strong&gt;Close Remote Connection&lt;/strong&gt; from the dropdown list.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S7b7ngsI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-close-ssh-session.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S7b7ngsI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/vs-code-close-ssh-session.png" alt="close Remote SSH"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Finished
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ezfFiJCL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/finished.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ezfFiJCL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/gloveboxes/PyLab-1-Debugging-a-Python-Internet-of-Things-Application/master/resources/finished.jpg" alt="finished"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/?WT.mc_id=devto-blog-dglover"&gt;Visual Studio Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.python.org/"&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.raspberrypi.org/"&gt;Raspberry Pi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fullstackpython.com/flask.html"&gt;Flask&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Trouble Shooting SSH Client Installation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/remote/ssh?WT.mc_id=devto-blog-dglover"&gt;Remote Development using SSH&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/remote/troubleshooting?WT.mc_id=devto-blog-dglover"&gt;Installing a supported SSH client&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vscode</category>
      <category>iot</category>
      <category>raspberrypi</category>
      <category>python</category>
    </item>
    <item>
      <title>PyCon Resources</title>
      <dc:creator>Dave Glover</dc:creator>
      <pubDate>Tue, 17 Sep 2019 08:08:33 +0000</pubDate>
      <link>https://forem.com/gloveboxes/pycon-shanghai-2019-resources-2noj</link>
      <guid>https://forem.com/gloveboxes/pycon-shanghai-2019-resources-2noj</guid>
      <description>&lt;h2&gt;
  
  
  Powerpoint Slides
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://microsoftapc-my.sharepoint.com/:p:/g/personal/dglover_microsoft_com/EQKN-2BQCRRHjMaIgQHFEIYBwAqrM9OEggAGd7bhRp6Axw?e=cmMVfE"&gt;Presentation (Mandarin)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://1drv.ms/p/s!AoksQQquzfG6hcFBqMPooHXaOLWEKg?e=e1sSyk"&gt;Presentation (English)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Vision Impaired Shopping Solution
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gloveboxes/Creating-an-image-recognition-solution-with-Azure-IoT-Edge-and-Azure-Cognitive-Services"&gt;Vision Impaired Shopping Solution on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python?WT.mc_id=pycon-blog-dglover"&gt;Create your first Python function in Azure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.toAzure%20Custom%20Vision%20AI"&gt;Azure Custom Vision AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://devblogs.microsoft.com/python?WT.mc_id=pycon-blog-dglover"&gt;https://devblogs.microsoft.com/python&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Azure/azure-functions-python-worker"&gt;Azure Functions Python Worker&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/iot-edge/how-to-deploy-modules-cli?WT.mc_id=pycon-blog-dglover"&gt;Deploy Azure IoT Edge modules with Azure CLI&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://azure.microsoft.com/en-au/try/cosmosdb?WT.mc_id=pycon-blog-dglover"&gt;https://azure.microsoft.com/en-au/try/cosmosdb&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>azure</category>
      <category>raspberrypi</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
