nanoFramework.Iot.Device.Max7219 1.2.864

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Max7219 --version 1.2.864
                    
NuGet\Install-Package nanoFramework.Iot.Device.Max7219 -Version 1.2.864
                    
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="nanoFramework.Iot.Device.Max7219" Version="1.2.864" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Max7219" Version="1.2.864" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Max7219" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Max7219 --version 1.2.864
                    
#r "nuget: nanoFramework.Iot.Device.Max7219, 1.2.864"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.Max7219@1.2.864
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Max7219&version=1.2.864
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Max7219&version=1.2.864
                    
Install as a Cake Tool

Max7219 (LED Matrix driver)

You can use Max7219.cs in your project to drive a Max7219 based Dot Matrix Module. Write to a 8x8 Dot Matrix Module demonstrates a concrete example using this class.

The following fritzing diagram illustrates one way to wire up the Max7219, with a MCU like ESP32.

ESP32 Breadboard diagram

Usage

Important: make sure you properly setup the SPI pins especially for ESP32 before creating the SpiDevice, make sure you install the nanoFramework.Hardware.ESP32 nuget:

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the SPI GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.SPI1_MOSI);
Configuration.SetPinFunction(22, DeviceFunction.SPI1_MISO);
Configuration.SetPinFunction(23, DeviceFunction.SPI1_CLOCK);
// Make sure as well you are using the right chip select

For other devices like STM32, please make sure you're using the preset pins for the SPI bus you want to use. The chip select can as well be pre setup.

You can use .NET Core to drive MAX7219 based Dot Matrix Modules.

These Modules can be cascaded to get a bigger matrix.

Accessing the MAX7219 via SPI

The MCU has support for SPI.

// Note: the ChipSelect pin should be adjusted to your device, here 42
var connectionSettings = new SpiConnectionSettings(1, 42)
{
    ClockFrequency = 10_000_000,
    Mode = SpiMode.Mode0
};
var spi = SpiDevice.Create(connectionSettings);
var devices = new Max7219(spi, cascadedDevices: 4);

The following pin layout:

  • MAX7219 VCC to MCU 5V
  • MAX7219 GND to MCU GND
  • MAX7219 DIN to MCU MOSI
  • MAX7219 CS to MCU Chip Select
  • MAX7219 CLK to MCU SPI Clock

Writing to the Matrix

Write a smiley to devices buffer.

var smiley = new byte[] { 
    0b00111100, 
    0b01000010, 
    0b10100101, 
    0b10000001, 
    0b10100101, 
    0b10011001, 
    0b01000010, 
    0b00111100 
    };
devices.Init();
devices.Rotation = RotationType.Half;
for (var i = 0; i < devices.CascadedDevices; i++)
{
    for (var digit = 0; digit < 8; digit++)
    {
        devices[new DeviceIdDigit( deviceId: i, digit: digit )] = smiley[digit];
    }

    devices.Flush();
}

Flush the smiley to the devices using a different rotation each iteration.

foreach (RotationType rotation in Enum.GetValues(typeof(RotationType)))
{
    devices.Rotation = rotation;
    devices.Flush();
    Thread.Sleep(1000);
}

Write "Hello World from MAX7219!" to the Matrix using different fonts each iteration.

devices.Init();
devices.Rotation = RotationType.Left;
var writer = new MatrixGraphics(devices, Fonts.CP437);
foreach (var font in new[]{Fonts.CP437, Fonts.LCD, Fonts.Sinclair, Fonts.Tiny, Fonts.CyrillicUkrainian}) {
    writer.Font = font;
    writer.ShowMessage("Hello World from MAX7219!", alwaysScroll: true);
}
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
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.2.907 158 10/2/2025
1.2.864 276 4/2/2025
1.2.852 242 3/11/2025
1.2.822 175 2/26/2025
1.2.775 182 2/4/2025
1.2.772 182 2/4/2025
1.2.755 204 1/31/2025
1.2.737 178 1/13/2025
1.2.696 184 12/16/2024
1.2.673 192 10/23/2024
1.2.631 202 8/28/2024
1.2.570 192 6/14/2024
1.2.560 197 5/29/2024
1.2.548 207 5/15/2024
1.2.490 260 2/23/2024
1.2.436 331 11/10/2023
1.2.329 284 5/26/2023
1.2.313 270 5/12/2023
1.2.297 268 5/3/2023
1.2.208 444 1/3/2023
1.2.203 418 12/28/2022
1.2.153 460 11/5/2022
1.2.141 495 10/25/2022
1.2.128 485 10/22/2022
1.2.122 540 10/12/2022
1.2.114 491 10/8/2022
1.2.95 547 9/22/2022
1.2.87 594 9/15/2022
1.2.73 519 9/8/2022
1.2.7 552 7/15/2022
1.2.5 558 7/13/2022
1.1.141.41205 564 7/6/2022
1.1.113.2032 578 6/23/2022
1.1.58.10097 544 5/23/2022
1.1.27 571 4/26/2022
1.1.20 546 4/21/2022
1.1.1 572 4/14/2022
1.0.300 583 3/31/2022
1.0.277-preview.125 224 3/25/2022
1.0.277-preview.115 196 3/21/2022
1.0.277-preview.111 212 3/18/2022
1.0.277-preview.110 209 3/18/2022
1.0.277-preview.106 217 3/15/2022
1.0.277-preview.105 201 3/15/2022
1.0.277-preview.98 212 3/8/2022
1.0.277-preview.89 244 2/27/2022
1.0.277-preview.87 224 2/26/2022
1.0.277-preview.85 215 2/25/2022
1.0.277-preview.77 231 2/18/2022
1.0.277-preview.75 209 2/16/2022
1.0.277-preview.73 226 2/12/2022
1.0.277-preview.70 236 2/10/2022
1.0.277-preview.65 212 2/9/2022
1.0.277-preview.60 236 2/4/2022
1.0.277-preview.53 231 1/31/2022
1.0.277-preview.41 230 1/28/2022
1.0.277-preview.32 230 1/27/2022
1.0.277-preview.30 240 1/27/2022
1.0.277-preview.17 232 1/24/2022
1.0.277-preview.13 244 1/21/2022
1.0.277-preview.1 241 1/11/2022
1.0.272 600 1/10/2022
1.0.259 426 12/9/2021
1.0.258 419 12/7/2021
1.0.236 325 11/3/2021
1.0.221 261 10/19/2021
1.0.219 287 10/19/2021
1.0.218 298 10/18/2021
1.0.157 278 9/4/2021
1.0.155 272 8/31/2021
1.0.153 294 8/14/2021
1.0.151 287 8/6/2021
1.0.148 268 7/22/2021
1.0.104 355 5/29/2021
1.0.97 297 5/28/2021
1.0.63 293 5/26/2021
1.0.44 305 5/24/2021