Introduction
This article demonstrates how to deploy a .NET core LED on and off the application on NOOBS OS using Raspberry pi. We will port a windows application to raspbian os with Visual Studio 2019.
About .Net Core
- NET Core is an open-source, general-purpose development platform maintained by Microsoft
- It's cross-platform (supporting Windows, macOS, and Linux)
- It supports the UWP and ASP.NET
- UWP - it is used to build a windows 10 and mobile application.
- ASP.NET - -It is used to build a web browser-based application.
Step 1
The first step will be to create a simple .NET Core console application for Windows. Start Visual Studio 2019 and select the console app. The project name is hellodotnetiot.
Then, you need to add the GPIO NuGet Package, so select the hellodotnetiot to right-click to more options available. Select NuGet Package and install the GPIO system configuration package.
Now, NuGet package managers are available here. Search the System.Device.Gpio then install the desired package.
Once again, check the package installation preview page.
Step 2
Next, go to the Project Name >> program.cs. Here is the code from program.cs, then replace the following code.
- using System;
- using System.Device.Gpio;
- using System.Threading;
- namespace hellodotnetiot
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello World, this is a dot net core iot app");
- int pin = 4;
- GpioController controller = new GpioController();
- controller.OpenPin(pin, PinMode.Output);
- while (true)
- {
- controller.Write(pin, PinValue.High);
- Thread.Sleep(1000);
- controller.Write(pin, PinValue.Low);
- Thread.Sleep(1000);
- }
- }
- }
- }


Logesh PalaniPosted Mar 4, 2020, 1:17 AM
Awesome article