Skip to content

DrMboga/RaspberryDotNetLedBlink

Repository files navigation

RaspberryDotNetLedBlink

This is a small example how to use .net Platform Invoke with PIGPIO library.

This small example supposes that:

  • GPIO pin 23 connected to Anode (+) of LED. Cathode (-) of LED is connected to GND via 220Ω resistor.
  • GPIO pin 24 is connected to one button leg. Second button leg is connected to GND

When program stars, it waits the button push. As button is pushed, LED starts blinking. Second button push switches off the blinking.

Install .net on Raspberry Pi

This project uses .Net 9. Instructions how to install .Net SDK to your Raspberry Pi you can find here

If the instructions don't work (as in my case). Instructions for manual .net installation:

  1. Go to the official website And click Download binaries -> Arm64 link. Copy the direct link from the download page.
  2. Download the distribution on Pi:
wget <URL_OF_THE_ARM64_TARBALL>
  1. Unpack tar pack:
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet-sdk-9.<whatever version is in downloaded file>-linux-arm64.tar.gz -C /usr/share/dotnet
  1. Setup symbolic link:
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
  1. Check if everything is OK
dotnet --version

A small tip how to set up your dev environment:

  1. I have set up my RPI as headless device
  2. Set up SSH Public Key Authentication
  3. Debug code in VS Code on my dev machine via Remote SSH

About

This is a small example how to use .net Platform Invoke on Raspberry Pi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages