张高兴的 Windows 10 IoT 开发笔记:使用 MAX7219 驱动数码管
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 驱动数码管的更多相关文章
- 张高兴的 Windows 10 IoT 开发笔记:使用 ADS1115 读取模拟信号
考虑到 Raspberry Pi 读取模拟信号是很烦人的事情,更何况是在没人玩的 Windows 10 IoT 下,所以准备正儿八经的写点东西. 需求:使用 Raspberry Pi 读取输出模拟信号 ...
- 张高兴的 Windows 10 IoT 开发笔记:使用 Lightning 中的软件 PWM 驱动 RGB LED
感觉又帮 Windows 10 IoT 开荒了,所以呢,正儿八经的写篇博客吧.其实大概半年前就想写的,那时候想做个基于 Windows 10 IoT 的小车,但树莓派原生不支持 PWM 啊.百度也搜不 ...
- 张高兴的 Windows 10 IoT 开发笔记:HC-SR04 超声波测距模块
HC-SR04 采用 IO 触发测距.下面介绍一下其在 Windows 10 IoT Core 环境下的用法. 项目运行在 Raspberry Pi 2/3 上,使用 C# 进行编码. 1. 准备 H ...
- 张高兴的 Windows 10 IoT 开发笔记:BH1750FVI 光照度传感器
BH1750FVI 是一款 IIC 接口的数字型光强度传感器集成电路.下面介绍一下其在 Windows 10 IoT Core 环境下的用法. 项目运行在 Raspberry Pi 2/3 上,使用 ...
- 张高兴的 Windows 10 IoT 开发笔记:部署 ASP.NET Core 2 应用
今天是大年初二,都去走亲戚了吧,享受一下这难得的能和亲友相聚的时光.而我就不一样了,今天一回到家就又开始瞎折腾了,哈哈哈. 问题背景 最近花了点时间用 ASP.NET Core 2 写了个个人博客,中 ...
- 张高兴的 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 ...
- 张高兴的 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 ...
- 张高兴的 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 ...
- 张高兴的 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 ...
随机推荐
- ionic组件清单
整理时间:2017-5-22 官网版本:v3.2.0 / 2017-05-10 / MIT Licensed / Release Notes
- FileStream类的使用(文件流)
1.什么是FileStream类 FileStream 类对文件系统上的文件进行读取.写入.打开和关闭操作,并对其他与文件相关的操作系统句柄进行操作,如管道.标准输入和标准输出.读写操作可以指定为同步 ...
- .net core 2.2 部署CentOS7(4)CentOS7下载并安装.NET SDK(软件开发工具包)
目录: .net core 2.2 部署CentOS7(1)安装虚拟机 .net core 2.2 部署CentOS7(2)给虚拟机安装CentOS7 .net core 2.2 部署CentOS7( ...
- 撩课-Web大前端每天5道面试题-Day25
1.web前端开发,如何提高页面性能优化? 内容方面: .减少 HTTP 请求 (Make Fewer HTTP Requests) .减少 DOM 元素数量 (Reduce the Number o ...
- WireShark 过滤 SSDP
在局域网中使用wireshark抓包过滤http的时候经常会出现一些干扰协议,例如SSDP,使用过滤条件"http"有可能出现N多ssdp包,如下图所示: SSDP:Simple ...
- 【学习笔记】--- 老男孩学Python,day18 面向对象------抽象类(接口类), 多态, 封装
抽象类,接口类 Python没有接口这个概念 抽象类(接口类): 目的是制定一个规范 要学会归一化设计,有重复的东西就要想把它们合并起来 from abc import ABCMeta, abstra ...
- HTML5扩展之微数据与丰富网页摘要——张鑫旭
一.微数据是? 一个页面的内容,例如人物.事件或评论不仅要给用户看,还要让机器可识别.而目前机器智能程度有限,要让其知会特定内容含义,我们需要使用规定的标签.属性名以及特定用法等.举个简单例子,我们使 ...
- 浅谈脚本化css(三)之方块运动函数
我们可以写一个让小方块运动的函数: div#demo { width: 100px; ; position: absolute; ; ; } var div = document.getElement ...
- JavaScript standard 代码规范的全文
这是 JavaScript standard 代码规范的全文. 掌握本规范的最好方法是安装并在自己的代码中使用它. 细则 使用两个空格进行缩进. eslint: indent function hel ...
- JavaScript、HTML、CSS学习—思维导图