Skip to content

DamianSuess/Test.RaspberryPiNet

Repository files navigation

Intro

This example uses C# for Raspberry Pi 3 and demonstrates remote debugging.

Fore note, all tests are performed using vs2019 (v16.4), RaspberryPi 3b v1.2 w/ Raspbian v9.

Linux - Launching the app

To launch your app using a clickable link on Desktop Linux.

We uploaded ours using WinSCP portable app to a new folder called TestApps under /home/pi/Desktop, and renamed the exe to test-pinet.exe to keep things simple.

Next, we'll create the clicking file. Open a console window and navigate to our new folder. Now, type sudo nano TestPi.sh and input the following content

#!/bin/bash
mono /home/pi/Desktop/TestApps/test-pinet.exe

Now give the TestPi.sh file executable rights

sudo chmod +x TestPi.sh

Give it a try by double clicking your file via the Desktop.

Raspberry Pi GPIO

.NET Core IoT

The C# snip below can be found at the .NET Core IoT samples.

Requires:

  • Red LED (1.8 - 2.2 Vf)
  • 100K resistor
  • GPIO pin 17 and GND.
int pin = 17;
GpioController controller = new GpioController();
controller.OpenPin(pin, PinMode.Output);

// Blink the LED
int lightTimeInMilliseconds = 1000;
int dimTimeInMilliseconds = 200;

while (true)
{
  Console.WriteLine($"Light for {lightTimeInMilliseconds}ms");
  controller.Write(pin, PinValue.High);

  Thread.Sleep(lightTimeInMilliseconds);
  Console.WriteLine($"Dim for {dimTimeInMilliseconds}ms");

  controller.Write(pin, PinValue.Low);
  Thread.Sleep(dimTimeInMilliseconds);
}

Resources

Raspberry Pi GPIO

Remote Debugging:

Releases

No releases published

Packages

No packages published

Languages