Zhang Yuexin

C# programmer. Know a bit of hardware knowledge. 3D model design novice.

张高兴 - 土味儿编程

高兴不高兴

张高兴的 Windows 10 IoT 开发笔记:使用 MAX7219 驱动 8×8 点阵

本文约 290 字,包含 1 张图片,4 个代码段,阅读时间约 1 分钟
QR Code

在手机上查看此页面


This is a Windows 10 IoT Core project on the Raspberry Pi 2/3, coded by C#.

GitHub:https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/MAX7219

Image

Connect

  • DIN - MOSI
  • CS - CS0
  • CLK - SCLK
  • VCC - 5V
  • GND - GND

Reference

https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/MAX7219/Reference

What Contains

In MAX7219.cs file

/// <summary>
/// Initialize MAX7219
/// </summary>
public async Task InitializeAsync();
/// <summary>
/// Set Register Data and Print
/// </summary>
/// <param name="row">Range from 0 to 7</param>
/// <param name="val">Printed data</param>
public void SetRow(int row, byte val);
/// <summary>
/// Set MAX7219 Decode Mode
/// </summary>
/// <param name="mode">Mode</param>
public void SetDecode(DecodeMode mode);
/// <summary>
/// Set Brightness
/// </summary>
/// <param name="val">In range 0-16</param>
public void SetIntensity(int val);
/// <summary>
/// Test Display
/// </summary>
/// <param name="mode">Mode</param>
public void DisplayTest(DisplayTestMode mode);
/// <summary>
/// Set MAX7219 Power
/// </summary>
/// <param name="mode">Mode</param>
public void SetPower(PowerMode mode);
/// <summary>
/// Cleanup
/// </summary>
public void Dispose();

How to Use

  • First, you need to create a MAX7219 object. After that you should call InitializeAsync() to initialize.
MAX7219 led = new MAX7219(0);
await led.InitializeAsync();
  • Secondly
led.SetDecode(DecodeMode.NoDecode);

for (int i = 0; i < 8; i++)
{
    led.SetRow(i, charByte[i]);
}
  • If you want to close the sensor, call Dispose().
led.Dispose();
最后更新时间 : 2017/05/20 13:05 张高兴 阅读(249) 评论(0)
文章标签: C# UWP IoT Raspberry Pi
  发表评论
Click to Refresh