<?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>DEV Community: Alberto Coppini</title>
    <description>The latest articles on DEV Community by Alberto Coppini (@skioppetto).</description>
    <link>https://dev.to/skioppetto</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%2F636015%2F7ca94d34-9bbf-467e-860c-2dccae497acc.jpeg</url>
      <title>DEV Community: Alberto Coppini</title>
      <link>https://dev.to/skioppetto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/skioppetto"/>
    <language>en</language>
    <item>
      <title>Choosing an IOT framework for homemade projects</title>
      <dc:creator>Alberto Coppini</dc:creator>
      <pubDate>Wed, 14 Jul 2021 17:28:55 +0000</pubDate>
      <link>https://dev.to/skioppetto/choosing-an-iot-framework-for-homemade-projects-4j8b</link>
      <guid>https://dev.to/skioppetto/choosing-an-iot-framework-for-homemade-projects-4j8b</guid>
      <description>&lt;p&gt;My project is still going on, I've some other posts in draft ready to post but before I need to put some more details. &lt;/p&gt;

&lt;p&gt;Now, I learned that low cost 433Mhz radio stuff is almost shit and for this reason I moved to a different technology. &lt;/p&gt;

&lt;p&gt;In my environment all the spaces inside as well as outside are well covered by wifi. I think this is a quite common situation and in the worst cases I can install some hardware to increase the signal power so ok: this solution sounds quite good and also SoCs are very cheap and simple to use. &lt;/p&gt;

&lt;p&gt;Today's goal is choose an IOT cloud framework to let my little IOT objects communicate between them without reinventing the wheel. &lt;/p&gt;

&lt;p&gt;I started from &lt;a href="https://www.hackster.io/channels/platforms?sort=last_project"&gt;hackster.io&lt;/a&gt; by looking on Platforms ordered by last updated: &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Grandeur
&lt;/h2&gt;

&lt;p&gt;Build, scale and manage IoT products with Grandeur as your universal backend.&lt;br&gt;
10 projects and 27 members&lt;/p&gt;

&lt;p&gt;quite young system, open source. Not so bad: a nice example &lt;a href="https://www.hackster.io/grandeurtech/pi-switch-a1c9f8"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;but it seems more related to dev html pages and control devices or monitor variables, this is not what I want, I beleave in manual, toucheable, sensefull controls (buttons, scrolls, visibile leds, I'd like to avoid smartphone apps, one more drop into the sea of useless notifications!). I need an IOT framework to draw workflows.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Blynk
&lt;/h2&gt;

&lt;p&gt;Blynk is the most popular IoT platform designed to connect your devices to the cloud, create apps to control them, and manage thousands of deployed products&lt;br&gt;
564 projects and 8,123 members&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I think I'll try to make a prototype with this! It permit to define devices with virtual pins used to get and post messages from the cloud. &lt;br&gt;
It's shipped with a nice &lt;a href="https://docs.blynk.io/en/getting-started/activating-devices/blynk-edgent-wifi-provisioning"&gt;wifi provisioning library&lt;/a&gt; that uses a firmware part and a blynk application to do it. I'll append three stories to my github issues: - PoC for WiFi provisioning, PoC for sending data, PoC for reading data and see what happen!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Microsoft
&lt;/h2&gt;

&lt;p&gt;Connect your assets with Microsoft's IoT software and hardware, gain deep insights—improve your decision making, in real-time.&lt;br&gt;
1,777 projects and 61,046 members&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Maybe later, maybe never&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. ThingSpeak
&lt;/h2&gt;

&lt;p&gt;Collect IoT sensor data, analyze and transform data with MATLAB, and act with IFTTT. Join the community of 350,000 makers, students, and engineers building IoT.&lt;br&gt;
334 projects and 3,163 members&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Matlab plugin to integrate IOT devices and data. The main purpose is data anaysis, this is not what I'm looking for&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Particle
&lt;/h2&gt;

&lt;p&gt;Build internet-connected hardware. Particle gives you the tools to connect everyday electronics to the internet.&lt;br&gt;
1,545 projects and 18,099 members&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This will be probably the next :) It seems nice and I need to deepen.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>TDD with PlatformIO #1</title>
      <dc:creator>Alberto Coppini</dc:creator>
      <pubDate>Sun, 23 May 2021 21:03:31 +0000</pubDate>
      <link>https://dev.to/skioppetto/tdd-with-platformio-1-55dp</link>
      <guid>https://dev.to/skioppetto/tdd-with-platformio-1-55dp</guid>
      <description>&lt;p&gt;hi all, this is my first post on this amazing platform. &lt;/p&gt;

&lt;p&gt;I'd like and I'll try to use this tool to talk about my hobbies, or at least, what was my job when I was I developer... but you know, who is born developer will be always a developer, it's a matter of finding the right place to spread the passion :)&lt;/p&gt;

&lt;p&gt;another thing before starting: sorry for my english, this is not my natural language and I'll write smoothly so I'm sure you'll find some errors. &lt;/p&gt;

&lt;p&gt;Let's start now&lt;/p&gt;

&lt;h2&gt;
  
  
  TDD development
&lt;/h2&gt;

&lt;p&gt;first of all, a brief introduction to TDD and why everyone should use it. &lt;br&gt;
One of the agile principles state: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;principle 3) Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.&lt;/p&gt;

&lt;p&gt;principle 9) Continuous attention to technical excellence and good design enhances agility.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;this two princicples could be in contrast as if I have to deliver frequently, it means about 2 or 3 weeks, how can pay attention on techincal excellence and good design, by experimenting new technologies and making refactoring to my code?&lt;br&gt;
This is a nice questions and of course when the agile manifesto was written the solution was ready and belong to the XP programming formalized by ser Kent Beck. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Test Driven Development&lt;/em&gt; is a rivolutionary approach to coding, more then &lt;em&gt;Test&lt;/em&gt; I'd like to use &lt;em&gt;Experiments&lt;/em&gt; as it's an empirical approach very similar to the Galileo's scientific  method: you have to prove your thesis by short experiments that step by step prove your hypothesis. &lt;br&gt;
THe flow has three steps: red, green, refactoring. Red means that your very first experiment will fail, second means that you make the smaller possible modification to let you test run, third means that between each step, after learning something new with your experiments, you can improve your code by refactoring it! Simple! This is what I've learn, for academical concepts please google tdd and you'll find all you need, I close this chapter by suggesting you this book: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test-Driven Development: By Example. Addison-Wesley. (ISBN 978-0321146533)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Preparing the Environment (on Windows)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;install &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;vscode&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;install &lt;a href="https://platformio.org/install/ide?install=vscode" rel="noopener noreferrer"&gt;platformio extension&lt;/a&gt;. This is a very nice framework built in python (fashion &amp;amp;&amp;amp; trendy). It helps in developing on different microcontrollers managing all the tool chain needed to compile and upload the firmware. In my opionion it's great for &lt;strong&gt;multi file management&lt;/strong&gt; and &lt;strong&gt;unit testing&lt;/strong&gt;, these are the reasons why I've chosen to leave the very straightforward arduino IDE in favour of it.
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;platformIO load the tool chain for the microcontroller you choose and let you run unit tests as firmware getting the test results from Serial. Ok, that's great but I've to test also some logic that don't need Arduino features like I/O, sleeps, interrupts... and I don't want to wait: I'm trying to use TDD, I'll run a lot of tests. &lt;a href="https://platformio.org/platforms/native/" rel="noopener noreferrer"&gt;platformIO native&lt;/a&gt; can help us.&lt;br&gt;
Install it from console&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; pio platform install native
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;and configure it on platformio.ini on your platformIO new project adding these lines&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[env:desktop]
platform = native
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Before using it, as noted &lt;a href="https://docs.platformio.org/en/latest/plus/unit-testing.html#test-types" rel="noopener noreferrer"&gt;here&lt;/a&gt; we need to install &lt;em&gt;GCC&lt;/em&gt; as host compiler. On Windows  the simpler way is by installing &lt;a href="https://www.msys2.org/#installation" rel="noopener noreferrer"&gt;msys2&lt;/a&gt;, a collection of unix clone tools. Following the intructions you can find all the steps needed to install GCC, it's very simple. Important: at the end add the bin folder to the PATH variable&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0y4tb94euo90splw779.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0y4tb94euo90splw779.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Let's try the unit testing. Add a dummy test like this on &lt;em&gt;test&lt;/em&gt; folder&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;unity.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;test_assert_running_desktop&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="n"&gt;TEST_ASSERT_TRUE&lt;/span&gt;&lt;span class="p"&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="k"&gt;const&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;UNITY_BEGIN&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;RUN_TEST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test_assert_running_desktop&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;UNITY_END&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;return&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;/code&gt;&lt;/pre&gt;



&lt;p&gt;from console call the pio command to run the test&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pio test -v -e desktop 
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;test should pass&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjpu360wadjjp6fjpvgx3.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjpu360wadjjp6fjpvgx3.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's all for today, ah... right, last thing: I configured the platformio unit testing to run native if is set up the &lt;em&gt;desktop&lt;/em&gt; environment when calling &lt;em&gt;pio test&lt;/em&gt;. What happen if I'll have to make also arduino unit tests? How can I select tests to be run in a desktop environment and tests to be run on board? There's a solution that I've seen on an example on &lt;a href="https://github.com/platformio/platformio-examples/tree/develop/unit-testing/calculator" rel="noopener noreferrer"&gt;github&lt;/a&gt;. First, move unit tests to two different subfolders like &lt;em&gt;test/desktop&lt;/em&gt; and &lt;em&gt;test/arduino&lt;/em&gt; and then add a &lt;em&gt;test&lt;/em&gt;&lt;em&gt;ignore&lt;/em&gt; filter on platformio.ini in this way&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[env:uno]
platform = atmelavr
board = uno
framework = arduino
test_ignore = desktop

[env:desktop]
platform = native
test_ignore = arduino
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;based on the -e parameter pio will launch only desktop or arduino unit test. &lt;/p&gt;

&lt;p&gt;Hope it can help, see you next week with the first tdd development cycle. &lt;/p&gt;

</description>
      <category>tdd</category>
      <category>cpp</category>
      <category>vscode</category>
      <category>platformio</category>
    </item>
  </channel>
</rss>
