Iot.Device.SenseHat.LedMatrixExt 1.0.2

.NET 6.0 .NET Core 3.1 .NET Standard 2.0
dotnet add package Iot.Device.SenseHat.LedMatrixExt --version 1.0.2
NuGet\Install-Package Iot.Device.SenseHat.LedMatrixExt -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Iot.Device.SenseHat.LedMatrixExt" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Iot.Device.SenseHat.LedMatrixExt --version 1.0.2
#r "nuget: Iot.Device.SenseHat.LedMatrixExt, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Iot.Device.SenseHat.LedMatrixExt as a Cake Addin
#addin nuget:?package=Iot.Device.SenseHat.LedMatrixExt&version=1.0.2

// Install Iot.Device.SenseHat.LedMatrixExt as a Cake Tool
#tool nuget:?package=Iot.Device.SenseHat.LedMatrixExt&version=1.0.2

Iot.Device.SenseHat.LedMatrixExt

NuGet

Extension methods of SenseHatLedMatrix to show unicode letter, message, or series values on Raspberry Pi Sense HAT running on Linux.

Getting started

  • Create a new console app (e.g. dotnet new console -o SenseHat.Sample).

  • Install Iot.Device.SenseHat.LedMatrixExt from NuGet (e.g. navigate inside the project directory and run dotnet add package Iot.Device.SenseHat.LedMatrixExt).

  • Explore the sample app SenseHat.QuickStart on how to build and run the app.

Extension methods of SenseHatLedMatrix

  • Clear LED Matrix
ledMatrix.Clear(Color? backColor = null)
  • Show a single letter (Unicode supported)
ledMatrix.ShowLetter(char letter, Color? foreColor = null, Color? backColor = null, Rotation rotation = Rotation.Rotate0)
  • Show a message (Unicode supported)
ledMatrix.ShowMessage(string message, Color? foreColor = null, Color? backColor = null, Rotation textRotation = Rotation.Rotate0, Direction scrollDirection = Direction.Left, int speedInMs = 90)
  • Show a series of values
ledMatrix.ShowSeriesValues(float[] values, Color? foreColor = null, Color? backColor = null, bool fill = false, Rotation rotation = Rotation.Rotate0, bool forward = true, int speedInMs = 90)

Unicode 8 x 8 Font

Built-in unicode characters

  • U+0000 - U+007F (basic latin)
  • U+00A0 - U+00FF (extended latin)
  • U+0390 - U+03C9 (greek characters)
  • U+3040 - U+309F (Hiragana)
  • U+2500 - U+257F (box drawing)
  • U+2580 - U+259F (block elements)
  • U+E541 - U+E55A (standard galactic alphabet)

Add custom characters

See section Encoding for glyph.

Font8x8.AddGlyph(char letter, byte[] glyph)

Encoding

Every character in the font is encoded row-wise in 8 bytes.

The most significant bit of each byte corresponds to the first pixel in a row.

The character 'A' (0x41 / 65) is encoded as { 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00 }

0x30 => 0011 0000 => ..XX....
0x78 => 0111 1000 => .XXXX...
0xCC => 1100 1100 => XX..XX..
0xCC => 1100 1100 => XX..XX..
0xFC => 1111 1100 => XXXXXX..
0xCC => 1100 1100 => XX..XX..
0xCC => 1100 1100 => XX..XX..
0x00 => 0000 0000 => ........

To access the nth pixel in a row, right-shift by 7-n.

                     . . X X . . . .
                     | | | | | | | |
(0x30 >> 7) & 1 == 0-+ | | | | | | |
(0x30 >> 6) & 1 == 0---+ | | | | | |
(0x30 >> 5) & 1 == 1-----+ | | | | |
(0x30 >> 4) & 1 == 1-------+ | | | |
(0x30 >> 3) & 1 == 0---------+ | | |
(0x30 >> 2) & 1 == 0-----------+ | |
(0x30 >> 1) & 1 == 0-------------+ |
(0x30 >> 0) & 1 == 0---------------+

Acknowledgements

Font8x8: https://github.com/dhepper/font8x8

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 174 1/13/2022
1.0.1 127 1/6/2022
1.0.0 137 1/6/2022