mirror of
https://github.com/LukeHagar/jims-blog.git
synced 2025-12-09 20:47:48 +00:00
41 lines
27 KiB
HTML
41 lines
27 KiB
HTML
<!doctype html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta http-equiv=x-ua-compatible content="ie=edge"><link rel=icon href=/fav.png type=image/png><link rel=preconnect href=https://fonts.googleapis.com><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=preload as=style href="https://fonts.googleapis.com/css2?family=Alata&family=Lora&family=Muli:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto&family=Muli:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"><link rel=stylesheet href="https://fonts.googleapis.com/css2?family=Alata&family=Lora&family=Muli:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto&family=Muli:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" media=print onload='this.media="all"'><noscript><link href="https://fonts.googleapis.com/css2?family=Alata&family=Lora&family=Muli:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto&family=Muli:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel=stylesheet></noscript><link rel=stylesheet href=/css/font.css media=all><meta property="og:title" content="Connecting Pycom boards to Azure IoT Hub"><meta property="og:description" content="Learn how to connect a PyCom board to Azure IoT Hub"><meta property="og:type" content="article"><meta property="og:url" content="https://jimbobbennett.dev/blogs/connecting-pycom-boards-to-azure-iot-hub/"><meta property="og:image" content="https://jimbobbennett.dev/blogs/connecting-pycom-boards-to-azure-iot-hub/banner.png"><meta property="article:section" content="blogs"><meta property="article:published_time" content="2019-04-10T12:38:16+00:00"><meta property="article:modified_time" content="2019-04-10T12:38:16+00:00"><meta property="og:site_name" content="JimBobBennett"><meta name=twitter:card content="summary_large_image"><meta name=twitter:image content="https://jimbobbennett.dev/blogs/connecting-pycom-boards-to-azure-iot-hub/banner.png"><meta name=twitter:title content="Connecting Pycom boards to Azure IoT Hub"><meta name=twitter:description content="Learn how to connect a PyCom board to Azure IoT Hub"><meta name=twitter:site content="@jimbobbennett"><meta name=twitter:creator content="@jimbobbennett"><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css integrity=sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3 crossorigin=anonymous><link rel=stylesheet href=/css/header.css media=all><link rel=stylesheet href=/css/footer.css media=all><link rel=stylesheet href=/css/theme.css media=all><link rel="shortcut icon" type=image/png href=/fav.png><link rel="shortcut icon" sizes=192x192 href=/fav.png><link rel=apple-touch-icon href=/fav.png><link rel=alternate type=application/rss+xml href=https://jimbobbennett.dev/index.xml title=JimBobBennett><script type=text/javascript>(function(e,t,n,s,o,i,a){e[n]=e[n]||function(){(e[n].q=e[n].q||[]).push(arguments)},i=t.createElement(s),i.async=1,i.src="https://www.clarity.ms/tag/"+o,a=t.getElementsByTagName(s)[0],a.parentNode.insertBefore(i,a)})(window,document,"clarity","script","dctc2ydykv")</script><style>:root{--text-color:#343a40;--text-secondary-color:#6c757d;--background-color:#000;--secondary-background-color:#64ffda1a;--primary-color:#007bff;--secondary-color:#f8f9fa;--text-color-dark:#e4e6eb;--text-secondary-color-dark:#b0b3b8;--background-color-dark:#000000;--secondary-background-color-dark:#212529;--primary-color-dark:#ffffff;--secondary-color-dark:#212529}body{background-color:#000;font-size:1rem;font-weight:400;line-height:1.5;text-align:left}</style><meta name=description content><link rel=stylesheet href=/css/index.css><link rel=stylesheet href=/css/single.css><link rel=stylesheet href=/css/projects.css media=all><script defer src=/fontawesome-5/all-5.15.4.js></script><title>Connecting Pycom boards to Azure IoT Hub | JimBobBennett</title></head><body class=light onload=loading()><header><nav class="pt-3 navbar navbar-expand-lg"><div class="container-fluid mx-xs-2 mx-sm-5 mx-md-5 mx-lg-5"><a class="navbar-brand primary-font text-wrap" href=/><img src=/fav.png width=30 height=30 class="d-inline-block align-top">
|
||
JimBobBennett</a>
|
||
<button class=navbar-toggler type=button data-bs-toggle=collapse data-bs-target=#navbarContent aria-controls=navbarContent aria-expanded=false aria-label="Toggle navigation"><svg aria-hidden="true" height="24" viewBox="0 0 16 16" width="24" data-view-component="true"><path fill-rule="evenodd" d="M1 2.75A.75.75.0 011.75 2h12.5a.75.75.0 110 1.5H1.75A.75.75.0 011 2.75zm0 5A.75.75.0 011.75 7h12.5a.75.75.0 110 1.5H1.75A.75.75.0 011 7.75zM1.75 12a.75.75.0 100 1.5h12.5a.75.75.0 100-1.5H1.75z"/></svg></button><div class="collapse navbar-collapse text-wrap primary-font" id=navbarContent><ul class="navbar-nav ms-auto text-center"><li class="nav-item navbar-text"><a class=nav-link href=/ aria-label=home>Home</a></li><li class="nav-item navbar-text"><a class=nav-link href=/#about aria-label=about>About</a></li><li class="nav-item navbar-text"><a class=nav-link href=/#projects aria-label=projects>Recent Highlights</a></li><li class="nav-item navbar-text"><a class=nav-link href=/blogs title="Blog posts">Blog</a></li><li class="nav-item navbar-text"><a class=nav-link href=/videos title=Videos>Videos</a></li><li class="nav-item navbar-text"><a class=nav-link href=/livestreams title=Livestreams>Livestreams</a></li><li class="nav-item navbar-text"><a class=nav-link href=/conferences title=Conferences>Conferences</a></li><li class="nav-item navbar-text"><a class=nav-link href=/resume title=Resume>Resume</a></li></ul></div></div></nav></header><div id=content><section id=projects><div class="container pt-5" id=list-page><div class="row justify-content-center px-3 px-md-5"><h1 class="text-left pb-2 content">Connecting Pycom boards to Azure IoT Hub</h1><div class="text-left content">Jim Bennett
|
||
<small>|</small>
|
||
Apr 10, 2019</div></div></div></section><section id=single><div class=container><div class="row justify-content-center"><div class="col-sm-12 col-md-12 col-lg-9"><div class=pr-lg-4><article class="page-content p-2"><p>I’m supporting an IoT hackathon over the weekend of April 27th/28th 2019. It will be a cool event, where you can win six months free business support from <a href=https://twitter.com/setsquared>SETsquared</a> – the world’s leading university business incubator. If you are interested, sign up here:</p><p><a href=https://www.eventbrite.com/e/the-big-iothack-tickets-58111865153>eventbrite.com/e/the-big-iothack-tickets-58111865153</a></p><p>As a part of this hackathon, <a href=https://pycom.io>PyCom</a> are providing a load of devices. These are tiny IoT development boards that run MicroPython, and can connect over WiFi, BLE, <a href=https://lora-alliance.org>LoRa</a> or <a href=https://www.sigfox.com/>SigFox</a>. PyCom have a service called PyBytes that can take data from the devices, and this can be integrated into <a href="https://azure.microsoft.com/services/iot-hub/?WT.mc_id=pycom-blog-jabenn">Azure IoT Hub</a>. To prepare for this event, I grabbed a board and started to play.</p><blockquote><p>You will need an Azure subscription to work thorough this. If you don’t have one, you can sign up for free at <a href="https://azure.microsoft.com/free/?WT.mc_id=pycom-blog-jabenn">azure.microsoft.com/free</a>. This will give you $200 of credit, access to free services for 12 months, and other services free forever. You will need a credit card, but this is only for validation - you will <strong>NOT</strong> be billed unless to choose to upgrade your subscription.</p></blockquote><h2 id=getting-started>Getting started</h2><h3 id=unpack-the-board>Unpack the board</h3><p>We were given a big box of kit to try out before the hackathon. It had a range of boards and shields inside.</p><figure><img src=IMG_0290.jpg></figure><p>I grabbed a WiPy and a Pysense board.</p><p>The <a href=https://pycom.io/product/wipy-3-0/>WiPy</a> is a WiFi and BLE enabled board running an ESP32 micro controller. It doesn’t have any sensors or USB connectivity, it needs to be added to an expansion board.</p><figure><img src=IMG_0286.jpg></figure><p>The <a href=https://pycom.io/product/pysense/>PySense</a> is an expansion board that the WiPy plugs into. It has a load of sensors as well as a USB port you can use to program the micro controller.</p><figure><img src=IMG_0287.jpg></figure><h3 id=plug-it-in>Plug it in</h3><p>The boards fit together, with the WiPy plugging into the socket on the Pysense. It took a bit of research to determine which way round to plug it in. Next I connected a WiFi antenna. Once it was all plugged together I connected the USB port to my Mac and an LED started flashing! Everyone loves blinking LEDs.</p><figure><img src=IMG_0293.jpg></figure><p>I then did the usual dance to upgrade the firmware by following the <a href=https://docs.pycom.io/gettingstarted/installation/firmwaretool.html>PyCom docs</a>. As a heads up, if you are using a Mac, unplug everything from the USB ports first otherwise you’ll get errors as it tried to push the firmware to the wrong device!</p><h3 id=configure-the-software>Configure the software</h3><p>Like a lot of developers, I love <a href="https://code.visualstudio.com/?WT.mc_id=pycom-blog-jabenn">Visual Studio Code</a>! PyCom provides an <a href="https://marketplace.visualstudio.com/itemdetails?itemName=pycom.Pymakr&WT.mc_id=pycom-blog-jabenn">extension for Code</a> that can talk to their boards.</p><figure><img src=2019-04-10_10-39-54.png></figure><h3 id=write-some-code>Write some code!</h3><p>These boards run <a href=https://www.micropython.org>MicroPython</a>, an implementation of Python designed to run on micro controllers. MicroPython projects have the following structure:</p><pre tabindex=0><code>Project folder
|
||
|-lib
|
||
| |- some_library.py
|
||
|- boot.py
|
||
|- main.py
|
||
</code></pre><p>Inside the project folder, there is an optional <code>lib</code> folder and two <code>.py</code> files. <code>boot.py</code> is optional and contains any code that you want run when the board boots up, such as connecting to WiFi. You can think of this as the same as the <code>setup</code> function in an Arduino C project. <code>main.py</code> is not optional, and contains the main code that will run on the device, analogous to the <code>loop</code> function in Arduino. It isn’t a loop as such, it won’t be called continuously, instead you will need to add your own processing loop. The <code>lib</code> folder is where you can put other <code>.py</code> files. This is the only directory that MicroPython will look in, you can’t put files in other directories or sub-directories of <code>lib</code>.</p><p>I created a new folder, and added <code>main.py</code> file. The code for this file is:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#f92672>import</span> pycom
|
||
</span></span><span style=display:flex><span><span style=color:#f92672>import</span> time
|
||
</span></span><span style=display:flex><span>
|
||
</span></span><span style=display:flex><span>pycom<span style=color:#f92672>.</span>heartbeat(<span style=color:#66d9ef>False</span>) <span style=color:#75715e># Turn off the heartbeat</span>
|
||
</span></span><span style=display:flex><span>
|
||
</span></span><span style=display:flex><span><span style=color:#66d9ef>while</span> <span style=color:#66d9ef>True</span>:
|
||
</span></span><span style=display:flex><span> pycom<span style=color:#f92672>.</span>rgbled(<span style=color:#ae81ff>0xFF0000</span>) <span style=color:#75715e># Red</span>
|
||
</span></span><span style=display:flex><span> time<span style=color:#f92672>.</span>sleep(<span style=color:#ae81ff>1</span>) <span style=color:#75715e># Sleep for 1 second</span>
|
||
</span></span><span style=display:flex><span> pycom<span style=color:#f92672>.</span>rgbled(<span style=color:#ae81ff>0x00FF00</span>) <span style=color:#75715e># Green</span>
|
||
</span></span><span style=display:flex><span> time<span style=color:#f92672>.</span>sleep(<span style=color:#ae81ff>1</span>) <span style=color:#75715e># Sleep for 1 second</span>
|
||
</span></span><span style=display:flex><span> pycom<span style=color:#f92672>.</span>rgbled(<span style=color:#ae81ff>0x0000FF</span>) <span style=color:#75715e># Blue</span>
|
||
</span></span><span style=display:flex><span> time<span style=color:#f92672>.</span>sleep(<span style=color:#ae81ff>1</span>) <span style=color:#75715e># Sleep for 1 second</span>
|
||
</span></span></code></pre></div><p>This code imports the <code>pycom</code> module containing code to interact with the board, and a <a href=https://docs.python.org/3/library/time.html><code>time</code> module</a> to provide access to code to sleep.</p><p>The code starts by turning off the heartbeat - this is a regular pulse of the on-board LED that shows you the board is powered on.</p><p>Next it runs a loop - using a <code>while True:</code> loop to always run the code. The suite inside this loop sets the LED to red, sleeps for a second, then green, sleep, then blue, sleep.</p><blockquote><p>Python is different to a lot of other languages in that <code>sleep</code> takes a time in seconds, not milliseconds.</p></blockquote><p>To deploy the code, launch the command palette and select <em>Pymakr->Run current file</em>. This will compile the code and run it to the device. Once done, the LED will start to flash red, then green, then blue.</p><figure><img src=2019-04-10_11-06-04.png></figure><p>This only runs the code on the device, it doesn’t store it permanently, so once the device is rebooted, the code is wiped. To upload the code so that it is maintained between reboots, use <em>Pymakr -> Upload project</em>.</p><h2 id=send-data-to-the-cloud-using-pybytes>Send data to the cloud using PyBytes</h2><p>Getting an LED flashing is cool, but what is cooler is getting data and sending it to the cloud. PyCom has a service called <a href=https://pybytes.pycom.io/>PyBytes</a> that takes in data from PyCom devices.</p><h3 id=connect-to-pybytes>Connect to PyBytes</h3><p>PyBytes makes it easy to configure your device. You add a new device from their Web dashboard, set up a unique name for it and the WiFi details for the WiFi you want the PyCom device to connect to. You then get an activation token that you can use when flashing the firmware to push these details to the device.</p><p>Flash the firmware, and configure it for PyBytes, setting the activation token.</p><p>Once the firmware is updated, the device will appear in the PyBytes dashboard.</p><figure><img src=2019-04-10_11-30-17.png></figure><h3 id=set-up-the-dashboard-to-receive-some-data>Set up the dashboard to receive some data</h3><p>PyBytes manages data as signals. A signal is data sent from the device, identified by a unique number. The PyBytes dashboard takes the signal data, enriches it with a name and unit and allows it to be displayed on a dashboard.</p><p>From the <strong>Data</strong> tab on the dashboard, I defined a new signal called <strong>Temperature</strong> for ID <code>0</code>, with the unit set to °C.</p><figure><img src=2019-04-10_11-34-34.png></figure><h3 id=send-some-data>Send some data</h3><p>Once the signal was created, I needed to send data to it from the PySense temperature sensor. There are libraries for accessing the PyBytes API, and the PySense board, and these need to be grabbed from the <a href=https://github.com/pycom/pycom-libraries>PyCom GitHub repo</a> and dropped in the <code>lib</code> folder. I grabbed the <code>[pysense.py](https://github.com/pycom/pycom-libraries/blob/master/pybytes/pysense/lib/pysense.py)</code> and <code>[pycoproc.py](https://github.com/pycom/pycom-libraries/blob/master/pybytes/pysense/lib/pycoproc.py)</code> libraries to talk to the PySense board, and the <code>[SI7006A20.py](https://github.com/pycom/pycom-libraries/blob/master/pybytes/pysense/lib/SI7006A20.py)</code> library to access the temperature sensor.</p><p>The code I used to send the data is:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#f92672>import</span> pycom
|
||
</span></span><span style=display:flex><span><span style=color:#f92672>import</span> _thread
|
||
</span></span><span style=display:flex><span><span style=color:#f92672>from</span> pysense <span style=color:#f92672>import</span> Pysense
|
||
</span></span><span style=display:flex><span><span style=color:#f92672>from</span> SI7006A20 <span style=color:#f92672>import</span> SI7006A20
|
||
</span></span><span style=display:flex><span><span style=color:#f92672>from</span> time <span style=color:#f92672>import</span> sleep
|
||
</span></span><span style=display:flex><span>
|
||
</span></span><span style=display:flex><span>pycom<span style=color:#f92672>.</span>heartbeat(<span style=color:#66d9ef>False</span>)
|
||
</span></span><span style=display:flex><span>
|
||
</span></span><span style=display:flex><span>py <span style=color:#f92672>=</span> Pysense() <span style=color:#75715e># Connect to the PySense board</span>
|
||
</span></span><span style=display:flex><span>si <span style=color:#f92672>=</span> SI7006A20(py) <span style=color:#75715e># Connect to the temperature sensor</span>
|
||
</span></span><span style=display:flex><span>
|
||
</span></span><span style=display:flex><span><span style=color:#66d9ef>while</span> <span style=color:#66d9ef>True</span>:
|
||
</span></span><span style=display:flex><span> pycom<span style=color:#f92672>.</span>rgbled(<span style=color:#ae81ff>0x0000FF</span>) <span style=color:#75715e># Flash the LED blue</span>
|
||
</span></span><span style=display:flex><span> temp <span style=color:#f92672>=</span> si<span style=color:#f92672>.</span>temperature() <span style=color:#75715e># Get the temperature</span>
|
||
</span></span><span style=display:flex><span> pybytes<span style=color:#f92672>.</span>send_signal(<span style=color:#ae81ff>0</span>, temp) <span style=color:#75715e># Send the temperature using signal 0</span>
|
||
</span></span><span style=display:flex><span> pycom<span style=color:#f92672>.</span>rgbled(<span style=color:#ae81ff>0x000000</span>) <span style=color:#75715e># Turn off the LED</span>
|
||
</span></span><span style=display:flex><span> sleep(<span style=color:#ae81ff>5</span>) <span style=color:#75715e># Sleep for 5 seconds</span>
|
||
</span></span></code></pre></div><p>This uses the <code>SI7006A20</code> temperature sensor to get the temperature, then sends a signal to PyBytes, using a signal id of <code>0</code>. This data then appears on the PyBytes dashboard.</p><figure><img src=2019-04-10_12-04-12.png></figure><h2 id=integrate-pybytes-with-iot-hub>Integrate PyBytes with IoT Hub</h2><p>PyBytes supports integrations with <a href="https://azure.microsoft.com/services/iot-hub/?WT.mc_id=pycom-blog-jabenn">Azure IoT Hub</a>, and it can push the data received from the device into IoT Hub.</p><h3 id=create-an-iot-hub>Create an IoT Hub</h3><p>I created a new IoT Hub instance to send the data to. I’ve got the <a href="https://marketplace.visualstudio.com/itemdetails?itemName=vsciot-vscode.vscode-iot-workbench/?WT.mc_id=pycom-blog-jabenn">Azure IoT Device Workbench extension</a> installed in Visual Studio Code, and this provides capabilities to configure IoT services from inside Code.</p><p>From the command palette, selecting <em>Azure IoT Hub -> Create IoT Hub</em> allows you to create a new IoT Hub. Follow the instructions, and you get a new IoT Hub set up.</p><h3 id=integrate-the-iot-hub-into-pybytes>Integrate the IoT Hub into PyBytes</h3><p>When the IoT Hub is running, open it up in the <a href="https://portal.azure.com/?WT.mc_id=pycom-blog-jabenn">Azure Portal.</a> Head to <em>Settings -> Shared Access Policies</em>, select the <em>registryReadWrite</em> policy and copy the <em>Connection string - Primary key</em>. PyBytes needs read and write permissions on the registry to register devices for you - each device configured in PyBytes becomes a device in IoT Hub.</p><figure><img src=2019-04-10_12-31-07.png></figure><p>From PyBytes, select <em>Integrations -> New Integration</em>. Select <em>Microsoft Azure</em>, then paste the connection string and select <em>Login</em>. Give the integration a name, enter a topic for the messages and select the devices you want to include. Then select <strong>Create</strong>. Once the integration is created, you can send a test message, then check for this in the IoT Hub.</p><figure><img src=2019-04-10_13-01-16.png></figure><p>You will also be able to see the device in the devices list both in the IoT Hub list, and in the <em>Azure IoT Hub Devices</em> section in the explorer. You can right-click on the device in the explorer and select <em>Start monitoring D2C messages…</em> to see a stream of the messages in the output window.</p><figure><img src=2019-04-10_13-02-35.png></figure><p>The data is raw, unenriched data showing the signal id and value.</p><h2 id=next-steps>Next steps</h2><p>Now that the data is flowing into IoT Hub, you can do anything you want with it - enrich it using <a href="https://azure.microsoft.com/services/stream-analytics/?WT.mc_id=pycom-blog-jabenn">stream analytics</a> or an <a href="https://azure.microsoft.com/services/functions/?WT.mc_id=pycom-blog-jabenn">Azure function</a>, do <a href="https://azure.microsoft.com/services/time-series-insights/?WT.mc_id=pycom-blog-jabenn">time series insights</a> on it, anything you want!</p><hr><p>All the code for this project is available on GitHub here: <a href=https://github.com/jimbobbennett/PyCom-AzureIoTHub>github.com/jimbobbennett/PyCom-AzureIoTHub</a></p></article></div></div><div class="col-sm-12 col-md-12 col-lg-3"><div class=sticky-sidebar><aside class=toc><h5>Table Of Contents</h5><div class=toc-content><nav id=TableOfContents><ul><li><a href=#getting-started>Getting started</a><ul><li><a href=#unpack-the-board>Unpack the board</a></li><li><a href=#plug-it-in>Plug it in</a></li><li><a href=#configure-the-software>Configure the software</a></li><li><a href=#write-some-code>Write some code!</a></li></ul></li><li><a href=#send-data-to-the-cloud-using-pybytes>Send data to the cloud using PyBytes</a><ul><li><a href=#connect-to-pybytes>Connect to PyBytes</a></li><li><a href=#set-up-the-dashboard-to-receive-some-data>Set up the dashboard to receive some data</a></li><li><a href=#send-some-data>Send some data</a></li></ul></li><li><a href=#integrate-pybytes-with-iot-hub>Integrate PyBytes with IoT Hub</a><ul><li><a href=#create-an-iot-hub>Create an IoT Hub</a></li><li><a href=#integrate-the-iot-hub-into-pybytes>Integrate the IoT Hub into PyBytes</a></li></ul></li><li><a href=#next-steps>Next steps</a></li></ul></nav></div></aside><aside class=tags><h5>Tags</h5><ul class="tags-ul list-unstyled list-inline"><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/technology target=_blank>technology</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/pycom target=_blank>Pycom</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/pymakr target=_blank>Pymakr</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/wipy target=_blank>WiPy</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/iot target=_blank>IoT</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/azure target=_blank>azure</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/iot-hub target=_blank>Iot Hub</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/visual-studio-code target=_blank>Visual Studio Code</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/vscode target=_blank>vscode</a></li><li class=list-inline-item><a href=https://jimbobbennett.dev/tags/python target=_blank>Python</a></li></ul></aside></div></div></div><div class=row><div class="col-sm-12 col-md-12 col-lg-9 p-4"><div id=disqus_thread></div><script>var disqus_config=function(){this.page.url="https://jimbobbennett.dev/blogs/connecting-pycom-boards-to-azure-iot-hub/",this.page.identifier="9e362c304210b6baad27b4df9cc37213"};(function(){if(window.location.hostname=="localhost")return;var e=document,t=e.createElement("script");t.src="https://jimbobbennett.disqus.com/embed.js",t.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(t)})()</script><noscript>Please enable JavaScript to view the <a href=https://disqus.com/?ref_noscript>comments powered by Disqus.</a></noscript></div></div></div><button class="p-2 px-3" onclick=topFunction() id=topScroll>
|
||
<i class="fas fa-angle-up"></i></button></section><script>var topScroll=document.getElementById("topScroll");window.onscroll=function(){scrollFunction()};function scrollFunction(){document.body.scrollTop>20||document.documentElement.scrollTop>20?topScroll.style.display="block":topScroll.style.display="none"}function topFunction(){document.body.scrollTop=0,document.documentElement.scrollTop=0}</script></div><footer><div class="container py-4"><div class="row justify-content-center"><div class="col-md-4 text-center">© 2023 All Rights Reserved</div></div></div></div></footer><script src=https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js integrity=sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13 crossorigin=anonymous></script>
|
||
<script>document.body.className.includes("light")&&(document.body.classList.add("dark"),localStorage.setItem("pref-theme","dark"))</script><script>let loadingIcons;function loading(){myVar=setTimeout(showPage,100)}function showPage(){try{document.getElementById("loading-icons").style.display="block"}catch{}}</script><script>function createCopyButton(e,t){const n=document.createElement("button");n.className="copy-code-button",n.type="button",n.innerText="Copy",n.addEventListener("click",()=>copyCodeToClipboard(n,e,t)),addCopyButtonToDom(n,e)}async function copyCodeToClipboard(e,t,n){const s=t.querySelector("pre > code").innerText;try{n.writeText(s)}finally{codeWasCopied(e)}}function codeWasCopied(e){e.blur(),e.innerText="Copied!",setTimeout(function(){e.innerText="Copy"},2e3)}function addCopyButtonToDom(e,t){t.insertBefore(e,t.firstChild);const n=document.createElement("div");n.className="highlight-wrapper",t.parentNode.insertBefore(n,t),n.appendChild(t)}if(navigator&&navigator.clipboard)document.querySelectorAll(".highlight").forEach(e=>createCopyButton(e,navigator.clipboard));else{var script=document.createElement("script");script.src="https://cdnjs.cloudflare.com/ajax/libs/clipboard-polyfill/2.7.0/clipboard-polyfill.promise.js",script.integrity="sha256-waClS2re9NUbXRsryKoof+F9qc1gjjIhc2eT7ZbIv94=",script.crossOrigin="anonymous",script.onload=function(){addCopyButtons(clipboard)},document.querySelectorAll(".highlight").forEach(e=>createCopyButton(e,script)),document.body.appendChild(script)}</script></body></html> |