https://github.com/drmboga/raspberrydotnetledblink
This is a small example how to use .net Platform Invoke on Raspberry Pi
https://github.com/drmboga/raspberrydotnetledblink
Last synced: 4 months ago
JSON representation
This is a small example how to use .net Platform Invoke on Raspberry Pi
- Host: GitHub
- URL: https://github.com/drmboga/raspberrydotnetledblink
- Owner: DrMboga
- License: mit
- Created: 2025-01-18T14:16:17.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-01-18T14:19:49.000Z (6 months ago)
- Last Synced: 2025-01-18T15:28:55.222Z (6 months ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RaspberryDotNetLedBlink
This is a small example how to use [.net Platform Invoke](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke) with [PIGPIO](https://abyz.me.uk/rpi/pigpio/cif.html) 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 GNDWhen 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](https://learn.microsoft.com/en-gb/dotnet/core/install/linux-debian?tabs=dotnet9)If the instructions don't work (as in my case). Instructions for manual .net installation:
1. Go to the [official website](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) And click `Download binaries -> Arm64` link. Copy the direct link from the download page.
2. Download the distribution on Pi:```bash
wget
```3. Unpack `tar` pack:
```bash
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet-sdk-9.-linux-arm64.tar.gz -C /usr/share/dotnet
```4. Setup symbolic link:
```bash
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
```5. Check if everything is OK
```bash
dotnet --version
```## A small tip how to set up your dev environment:
1. I have set up my RPI as [headless device](https://www.raspberrypi.com/documentation/computers/configuration.html#setting-up-a-headless-raspberry-pi)
2. Set up [SSH Public Key Authentication](https://www.ssh.com/academy/ssh/public-key-authentication#setting-up-public-key-authentication-for-ssh)
3. Debug code in VS Code on my dev machine via [Remote SSH](https://code.visualstudio.com/docs/remote/ssh)