Introduction
Third introductory article on the 'Internet of Things', written in collaboration with
Piero Sbressa. After the installation of Windows 10, IoT Core found at this
link, Now we will try to create an application in order to blink an LED, but stated that normally turn on or flashing an LED is not considered IoT, but in this case, serves to give an introduction and an idea of how to develop future applications or prototypes Raspberry Pi2 with Visual Studio 2015.
Electronic circuit
The material that we need can be found in the following image:
Figure 1: Requirement material
The final connection you see in the following picture:
Figure 2: Final connection
Figure 3: Connection
Figure 4: Pin Circuit with LED
Figure 5: Circuit with LED
Below is the diagram of the electronic circuit. It states that to create a circuit or draw, are necessary for my personal experience, as well as a dedicated software and hardware parts of the bases on the basics of electronics, otherwise my advice and devote themselves to the development of the code and leave to others the task earlier.
Figure 6: Electronic circuit
From the previous image, we note that we have two cables, one black, and one red. The black cable representing zero volt connect me to pin GPIO5 corresponding to the pin 29 that are on the GPIO card Raspberry Pi2. The red wire on pin 3.3V PWR corresponding to pin 1. Below the connector pin GPIO thus facilitate us to connect.
Figure 7: GPIO thus facilitate us to connect
Importantly, the Led diode to work, must be properly connected, ie the katodo (because it recognizes and the shorter leg) must be connected to zero volts, the anode that is the other leg on the positive, which in this case It will be given by pin 3.3V PWR. Wrong wiring will not allow the diode LED work, you may damage the component. The resistance is important because generally, a Led diode operates at a voltage of about 3.3V dc, in this case, it means that there is a voltage drop necessary and thus provide the correct voltage.
Setting up your PC in developer mode
Before starting to develop code, you must set the mode "developer" of our PC, otherwise, it will not be possible to develop and test their applications. The procedure is very simple. We point the mouse on the icon of the notifications as shown.
Figure 8: Notifications
In the next dialog box, select "
All Settings".
Figure 9: Select "All Settings"
We will be led to the next screen, select the command "
Update and security."
Figure 10: Select the command "Update and security"
We go to the next screen select the "
For developers," and soon after Developer mode.
Figure 11: Select the "For developers"
A dialog box will appear, where we have to confirm with "
Yes" key to activate this mode.
Figure 12: Confirm with "Yes" key to activate this mode
Let's confirmation and we have enabled our PC development.
Figure 13: Enabled our PC development
Now we are ready to create our first project IoT.
Creating the project
Before starting with the development, we have yet to download and install the Windows library IoT Core Project Templates found at this
link. In this library, you will find everything you need for the development of Raspberry Pi2 and beyond, we will see later in the article. Now open Visual Studio, and create a new project Universal Windows App, in C#.
Figure 14: Create a new project Universal Windows App
We need at this point to add a Reference to the 'Windows SDK IoT extension for the UWP, as shown below.
Figure 15: Windows SDK IoT exstension for the UWP
Now let's add in the Grid Xaml the following code:
After the piece of code before test the application, you need to set a few things to see. The first being that we are developing on Raspberry Pi2, and to set the ARM compilation mode, you can perform from the menu as in this figure.
In reference to the previous image, you will notice that is on the run as "Remote computer". This is because we want to run the application on the card Raspberry Pi2. Select this mode, and the following screen should be placed the device name and the IP address of the Raspberry Pi2, clearing authentication, or you can change these settings by selecting the project, right-click, select "Properties" and immediately after "Debug", we will be led by the following screen.
We can now proceed with the execution of our first application. F5 key and if we did everything correctly our LED lights up when you click on the button that we have in the MainPage, as we can see from the following pictures.
In this article, we created our first application with Raspberry Pi2 and Visual Studio 2015, starting from the design, implementation of the electronic circuit, set the PC mode developer, to finish with the programming and coding for the management of the LED. In subsequent articles, we will try to create other test projects, the purpose of these mini-articles is to give an introduction on how to design and create their own project and why not be able then to make our business. The article was written by
. And