Now that my development computer is setup, I wanted to look at some code. So I explored a little around the start up sample projects offered by Adafruit where I purchased the Microsoft IoT Pack for Raspberry Pi 2. I also looked at Microsoft supplied samples and the Raspberry Pi Foundation web site.
My goal here was: To look at code to understand the general anatomy of the process to develop IoT devices using the Raspberry Pi. To see someone using the GPOI in C#.
I found tons of good projects of all kind. I just wanted one that would be simple, but would give me an overall view. The one offered by Adafruit offered all the information I wanted:
This blog post clarified a number of points for me:
Windows Universal Application
Visual Studio offers a large amount project templates. Choosing the right template can mean the difference between success and re-doing everything. Unfortunately for me, having done mostly ASP.NET and MVC (with some WPF) applications for the past 15 years, I was not aware of the Windows Universal application thread.
I had already started coding some useful libraries that I wanted to re-use across multiple project types. I used the Portable Libraries project type for those. Of course, I could just copy/paste the code into a Windows Universal class library but that defeats the purpose of re-use… Some re-design will be required there for sure.
WPF User Interface on the Device
I did not expect this and I did not expect it would be this easy. You can write the User Interface for your application to run directly on the device.
Best of all it’s WPF and I am quite comfortable with it. I see great things happening in this department!
Coding the GPIO
Although the code in this application is very linear and repetitive (for simplicity purpose I am sure), it shows that the code to access and control the GPIO is simple. I did some additional research and figured out that: Yeah! This is actually really simple!
Building Electronic Circuit
Last time I wrote an electronic circuit was in 1992. I do have a lot updating to do. The section “Building out the circuit” in this sample was just what I needed to get me thinking about this again.
Perhaps the most interesting thing here is Fritzing . Fritzing is an application to create and document your electronic circuit prototype. That is definitely something I will have to explore deeper.
Running and Debugging
There is no talk about debugging, but running seems quite easy and strait forward. Just start the application on the device, provide device IP address and Voila!
I feel quite confident we can get this working and have fun doing it. This is going to be a lot easier than I expected!