Prev: Dotnet Core on Raspberry Pi

Next: Building and running the App...



VS Code Folders

This was the projects that I created for the solution. There are three projects LEDButtonApp, LEDButtonLib and LEDButtonLibTests. The other files tasks.json, launch.json and publish.ps1 are scripts to build, publish (to the Raspberry Pi), and run the code. The remaining items are .gitignore for git and Doc which is where I would store all the documentation for GitHub.

LedButtonApp

This is the main executable. I decided to do this as a console app.

LedButtonLib

This is the library with the code that interfaces with the board.

LedButtonLibTests

I decided to write a set of unit tests for the library.


You can find the source here, but here are a few notes:

  • The console app uses commandlineparser to make things easier. This project is pretty straightforward.
  • The LedButtonLib uses the .NET Core IoT Libraries which seem very well written and maintained.
  • I decided to have separate classes for the LEDs, buttons (and eventually fan and piezo) and it became apparent that I needed a base class (CustomController) which has all the construction and disposal code.
  • The tests use mocking (Moq). I couldn't mock the GpioController, so I mocked the GpioDevice instead. To do this I had to use the Protected method in Moq.


Prev: [Main Page][RPI-dotnet-mainPage]

Next: [Building and running the App...][RPI-dotnet-build-and-run]