Raspberry Pi’s can run C# controlling the GPIO with the librarys below. I had a hoon at https://github.com/carlpaton/SweetPi.
- System.Device.Gpio and System.Device.Gpio Namespace
- Iot.Device.Bindings
Install .Net Core
I tried to use the dotnet-install scripts and even after manually adding to path it didnt work. So I did it manually:
Update the OS
1 | sudo apt-get update |
Check for dotnet and install it
1 | dotnet --info ~ fails: 'dotnet1' is not recognized as an internal or external command, operable program or batch file. |
At the time these were latest but always check dotnet.microsoft.com/download for the latest versions.
1 | mkdir dev |
The tar command is also used to extract tar archives:
1 | mkdir dotnet-arm32 |
Adding export
above only adds it for that session, you can perminantly add it as follows
1 | echo $PATH ~ wont have `dev/dotnet` |
- https://docs.microsoft.com/en-us/dotnet/iot/deployment
- https://dotnet.microsoft.com/download
- https://www.raspberrypi.org/blog/visual-studio-code-comes-to-raspberry-pi/
- https://edi.wang/post/2019/9/29/setup-net-core-30-runtime-and-sdk-on-raspberry-pi-4
- https://elbruno.com/2020/01/05/raspberrypi-how-to-solve-dotnet-core-not-recognized-after-reboot/
Install VS Code
I like to edit and run the code on the Pi, VS code can be used with the C# extensions.
1 | sudo apt update |
Hardware ideas & Help
Its amazing the things people share online, helps noobs like me!
LED
LEDS & Resistors
Servos
Sensor
Breadboards
Netstat & UFW
You can confirm if the port is listing on your Pi with netstat -nltp
, it needs to have a Local Address
of :::5001
this means its listing to the outside world.
All ports on the Pi should be open but if this still doesnt work you can try Uncomplicated Firewall (UFW) which is a front-end to iptables.
1 | apt-get install ufw |