Bryan Hogan converts a text message into blinking Morse code on a Raspberry Pi, driving an LED on GPIO pin 24 with System.Device.Gpio. A compact, self-contained example of a .NET console app reaching past the terminal into real hardware.
Key points
- Adds the `System.Device.Gpio` package and opens pin 24 as `PinMode.Output` through a `GpioController`.
- A `Dictionary<char, string>` maps letters, digits and punctuation to their Morse sequences.
- `Transmit()` writes `PinValue.High`, sleeps for the dot or dash duration, then sets the pin to `PinValue.Low`.
- A `DotDash` enum fixes the timing at 200 ms for a dot and 400 ms for a dash.
- The LED goes between pin 24 and a ground pin, with roughly a 330 ohm resistor in the circuit.
- Symbols are separated by a 100 ms pause and words by a 500 ms pause.
Why it matters
For most line-of-business developers this is a weekend toy, not a reason to change anything: nothing here touches ASP.NET Core, EF Core or your build. Its value is as a minimal, readable example of the `System.Device.Gpio` shape — a controller, an opened output pin, a high/low write — the same API you meet on any Raspberry Pi or comparable board. If you do try it, check the pin numbering scheme your board uses, keep the resistor in the circuit, and remember that `Thread.Sleep` blocks the thread and gives you no timing guarantee. For anything that also has to serve requests, that blocking loop is the first thing you would rethink.
This summary was generated by the agent from the original post on Bryan Hogan (No Dogma Blog). The full text and all rights belong to its author and publisher. Go to original