nanoFramework.Iot.Device.Max7219
1.1.27
Prefix Reserved
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Max7219 --version 1.1.27
NuGet\Install-Package nanoFramework.Iot.Device.Max7219 -Version 1.1.27
<PackageReference Include="nanoFramework.Iot.Device.Max7219" Version="1.1.27" />
paket add nanoFramework.Iot.Device.Max7219 --version 1.1.27
#r "nuget: nanoFramework.Iot.Device.Max7219, 1.1.27"
// Install nanoFramework.Iot.Device.Max7219 as a Cake Addin #addin nuget:?package=nanoFramework.Iot.Device.Max7219&version=1.1.27 // Install nanoFramework.Iot.Device.Max7219 as a Cake Tool #tool nuget:?package=nanoFramework.Iot.Device.Max7219&version=1.1.27
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.
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.
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
};
for (var i = 0; i < devices.CascadedDevices; i++)
{
for (var digit = 0; digit < 8; digit++)
{
devices[i, digit] = smiley[digit];
}
}
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.12.0)
- nanoFramework.Runtime.Events (>= 1.10.0)
- nanoFramework.System.Device.Gpio (>= 1.0.4)
- nanoFramework.System.Device.Spi (>= 1.2.1)
- nanoFramework.System.Math (>= 1.4.4)
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.673 | 82 | 10/23/2024 |
1.2.631 | 101 | 8/28/2024 |
1.2.570 | 95 | 6/14/2024 |
1.2.560 | 102 | 5/29/2024 |
1.2.548 | 104 | 5/15/2024 |
1.2.490 | 154 | 2/23/2024 |
1.2.436 | 272 | 11/10/2023 |
1.2.329 | 189 | 5/26/2023 |
1.2.313 | 157 | 5/12/2023 |
1.2.297 | 159 | 5/3/2023 |
1.2.208 | 345 | 1/3/2023 |
1.2.203 | 320 | 12/28/2022 |
1.2.153 | 368 | 11/5/2022 |
1.2.141 | 371 | 10/25/2022 |
1.2.128 | 381 | 10/22/2022 |
1.2.122 | 433 | 10/12/2022 |
1.2.114 | 394 | 10/8/2022 |
1.2.95 | 437 | 9/22/2022 |
1.2.87 | 496 | 9/15/2022 |
1.2.73 | 423 | 9/8/2022 |
1.2.7 | 447 | 7/15/2022 |
1.2.5 | 449 | 7/13/2022 |
1.1.141.41205 | 439 | 7/6/2022 |
1.1.113.2032 | 454 | 6/23/2022 |
1.1.58.10097 | 439 | 5/23/2022 |
1.1.27 | 458 | 4/26/2022 |
1.1.20 | 429 | 4/21/2022 |
1.1.1 | 460 | 4/14/2022 |
1.0.300 | 447 | 3/31/2022 |
1.0.277-preview.125 | 122 | 3/25/2022 |
1.0.277-preview.115 | 108 | 3/21/2022 |
1.0.277-preview.111 | 122 | 3/18/2022 |
1.0.277-preview.110 | 116 | 3/18/2022 |
1.0.277-preview.106 | 128 | 3/15/2022 |
1.0.277-preview.105 | 116 | 3/15/2022 |
1.0.277-preview.98 | 124 | 3/8/2022 |
1.0.277-preview.89 | 128 | 2/27/2022 |
1.0.277-preview.87 | 114 | 2/26/2022 |
1.0.277-preview.85 | 127 | 2/25/2022 |
1.0.277-preview.77 | 117 | 2/18/2022 |
1.0.277-preview.75 | 116 | 2/16/2022 |
1.0.277-preview.73 | 121 | 2/12/2022 |
1.0.277-preview.70 | 127 | 2/10/2022 |
1.0.277-preview.65 | 122 | 2/9/2022 |
1.0.277-preview.60 | 140 | 2/4/2022 |
1.0.277-preview.53 | 132 | 1/31/2022 |
1.0.277-preview.41 | 132 | 1/28/2022 |
1.0.277-preview.32 | 137 | 1/27/2022 |
1.0.277-preview.30 | 141 | 1/27/2022 |
1.0.277-preview.17 | 141 | 1/24/2022 |
1.0.277-preview.13 | 135 | 1/21/2022 |
1.0.277-preview.1 | 133 | 1/11/2022 |
1.0.272 | 473 | 1/10/2022 |
1.0.259 | 308 | 12/9/2021 |
1.0.258 | 314 | 12/7/2021 |
1.0.236 | 210 | 11/3/2021 |
1.0.221 | 162 | 10/19/2021 |
1.0.219 | 170 | 10/19/2021 |
1.0.218 | 204 | 10/18/2021 |
1.0.157 | 178 | 9/4/2021 |
1.0.155 | 165 | 8/31/2021 |
1.0.153 | 171 | 8/14/2021 |
1.0.151 | 189 | 8/6/2021 |
1.0.148 | 173 | 7/22/2021 |
1.0.104 | 256 | 5/29/2021 |
1.0.97 | 189 | 5/28/2021 |
1.0.63 | 179 | 5/26/2021 |
1.0.44 | 209 | 5/24/2021 |