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_7Segment

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="index">Segment index, range from 0 to 7</param>
/// <param name="val">Printed data</param>
/// <param name="isDecimal">Does it show Decimal Point (Only for DecodeMode is Digit7)</param>
public void SetSegment(int index, byte value, bool isDecimal = false);
/// <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>
/// Clear the Segment
/// </summary>
public void Clear();
/// <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, DecodeMode.Digit7);
await led.InitializeAsync();
led.SetIntensity(5);
  • Secondly
for (int i = 0; i < 8; i++)
{
led.SetSegment(i, (byte)i);
}
  • If you want to close the sensor, call Dispose().
led.Dispose();

张高兴的 Windows 10 IoT 开发笔记:使用 MAX7219 驱动数码管的更多相关文章

  1. 张高兴的 Windows 10 IoT 开发笔记:使用 ADS1115 读取模拟信号

    考虑到 Raspberry Pi 读取模拟信号是很烦人的事情,更何况是在没人玩的 Windows 10 IoT 下,所以准备正儿八经的写点东西. 需求:使用 Raspberry Pi 读取输出模拟信号 ...

  2. 张高兴的 Windows 10 IoT 开发笔记:使用 Lightning 中的软件 PWM 驱动 RGB LED

    感觉又帮 Windows 10 IoT 开荒了,所以呢,正儿八经的写篇博客吧.其实大概半年前就想写的,那时候想做个基于 Windows 10 IoT 的小车,但树莓派原生不支持 PWM 啊.百度也搜不 ...

  3. 张高兴的 Windows 10 IoT 开发笔记:HC-SR04 超声波测距模块

    HC-SR04 采用 IO 触发测距.下面介绍一下其在 Windows 10 IoT Core 环境下的用法. 项目运行在 Raspberry Pi 2/3 上,使用 C# 进行编码. 1. 准备 H ...

  4. 张高兴的 Windows 10 IoT 开发笔记:BH1750FVI 光照度传感器

    BH1750FVI 是一款 IIC 接口的数字型光强度传感器集成电路.下面介绍一下其在 Windows 10 IoT Core 环境下的用法. 项目运行在 Raspberry Pi 2/3 上,使用 ...

  5. 张高兴的 Windows 10 IoT 开发笔记:部署 ASP.NET Core 2 应用

    今天是大年初二,都去走亲戚了吧,享受一下这难得的能和亲友相聚的时光.而我就不一样了,今天一回到家就又开始瞎折腾了,哈哈哈. 问题背景 最近花了点时间用 ASP.NET Core 2 写了个个人博客,中 ...

  6. 张高兴的 Windows 10 IoT 开发笔记:串口红外编解码模块 YS-IRTM

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

  7. 张高兴的 Windows 10 IoT 开发笔记:无线收发芯片 nRF24L01

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

  8. 张高兴的 Windows 10 IoT 开发笔记:FM 电台模块 KT0803L

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

  9. 张高兴的 Windows 10 IoT 开发笔记:0.96 寸 I2C OLED

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

随机推荐

  1. [转]How to tell NLog to log exceptions?

    本文转自:https://stackoverflow.com/questions/9199073/how-to-tell-nlog-to-log-exceptions 问: Target: <t ...

  2. tr循环,每行 2个数相加 求出和位第三个数赋值 (http://jsfiddle.net/hgeL44rz/113/)

    <table id="tb"> <tr> <th>单价</th> <th>数量</th> <th> ...

  3. MySQL 学习 --- 数据结构和索引

    本文参考了多篇文章集成的笔记,希望各位学习之前可以阅读以下参考资料先 概述 文章分几个部分 :第一部分介绍了B-Tree 和 B+Tree 这种数据结构作为索引:第二部分介绍索引的最左前缀原则和覆盖索 ...

  4. [C语言] 数据结构-预备知识动态内存分配

    动态内存分配 静态内存分配数组 int a[5]={1,2,3,4,5}  动态内存分配数组 int len=5; int *parr=(int *)malloc(sizeof(int) * len) ...

  5. LDA和PCA区别

    https://blog.csdn.net/brucewong0516/article/details/78684005

  6. spring Controller 层注解获取 properties 里面的值

    前言:最近在做一个项目,想要在 controller 层直接通过注解 @Value("")来获取 properties 里面配置的属性. 这个其实和 springmvc.sprin ...

  7. 浅谈脚本化css(二)

    查询计算样式 window上面有一个方法叫做getComputedStyle可以来获取元素的计算样式,也就是css样式.   window.getComputedStyle(ele. null); J ...

  8. opencv3.2.0形态学滤波之腐蚀

    /* 腐蚀(erode)含义: 腐蚀和膨胀是相反的一对操作,所以腐蚀就是求局部最小值的操作,腐蚀操作使原图中 国的高亮部分被腐蚀,效果图比原图有更小的高亮的区域. 腐蚀函数原型API及参数同膨胀相同 ...

  9. ShortcutBadger添加桌面角标(Badge)

    1.简介:角标原本是苹果的ios中的东西,android原生并不支持角标,因为google的意思是让大家用notification(提示栏)即可,不过无妨,厉害的android第三方厂商可以通过在自定 ...

  10. nodejs lodash的一些函数

    1   _.compact用法   _.compact([0, 1, false, 2, '', 3,'mm']); var test = _.compact([-1,0, 1, false, 2, ...