张高兴的 Windows 10 IoT 开发笔记:无线收发芯片 nRF24L01
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/NRF24L01
Image

Connect

nRF1
- VCC - 3.3V (Best)
- GND - GND
- MOSI - SPI0 MOSI (GPIO 10)
- MISO - SPI0 MISO (GPIO 9)
- SCK - SPI0 SCLK (GPIO 11)
- CSN - SPI0 CS0 (GPIO 8)
- CE - GPIO 23
- IRQ - GPIO 24
nRF2
- VCC - 3.3V (Best)
- GND - GND
- MOSI - SPI1 MOSI (GPIO 20)
- MISO - SPI1 MISO (GPIO 19)
- SCK - SPI1 SCLK (GPIO 21)
- CSN - SPI1 CS0 (GPIO 16)
- CE - GPIO 5
- IRQ - GPIO 6
What Contains
In NRF24L01.cs file
/// <summary>
/// Initialize
/// </summary>
public async Task InitializeAsync();
/// <summary>
/// Send
/// </summary>
/// <param name="data">Data</param>
public async void Send(byte[] data);
/// <summary>
/// Receive
/// </summary>
/// <param name="length">Packet Size</param>
/// <returns>Data</returns>
public byte[] Receive(byte length);
......
How to Use
- First, you need to create a NRF24L01 object. After that you should call InitializeAsync() to initialize.
// Create and Initialize
// CSN Pin, CE Pin, IRQ Pin, SPI Friendly Name, Receive Packet Size
NRF24L01 sender = new NRF24L01(0, 23, 24, "SPI0", 12);
NRF24L01 receiver = new NRF24L01(0, 5, 6, "SPI1", 12);
await sender.InitializeAsync();
await receiver.InitializeAsync();
- Secondly
sender.Send(Encoding.UTF8.GetBytes("ZhangGaoxing"));
receiver.ReceivedData += Receiver_ReceivedData;
private void Receiver_ReceivedData(object sender, ReceivedDataEventArgs e)
{
var raw = e.Data.Skip(1).ToArray();
var res = Encoding.UTF8.GetString(raw);
Debug.Write("Received Raw Data : ");
foreach (var item in raw)
{
Debug.Write($"{item} ");
}
Debug.WriteLine("");
Debug.WriteLine($"Received Data : {res}");
}
- If you want to close the sensor, call Dispose().
sender.Dispose();
receiver.Dispose();
张高兴的 Windows 10 IoT 开发笔记:无线收发芯片 nRF24L01的更多相关文章
- 张高兴的 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 开发笔记: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 ...
- 张高兴的 Windows 10 IoT 开发笔记:使用 MAX7219 驱动数码管
This is a Windows 10 IoT Core project on the Raspberry Pi 2/3, coded by C#. GitHub:https://github.co ...
随机推荐
- Node.js进程管理之Process模块
在前面Node.js事件运行机制也有提到,Node.js应用在单个线程运行,但是现在大部分服务器都是多处理器,为了方便使用多个进程,Node.js提供了3个模块.Process模块提供了访问正在运行的 ...
- springboots 配置文件
1.build.gradle buildscript { // 声明变量 ext { springBootVersion = '1.5.2.RELEASE' } // 仓库 repositories ...
- s11d27 算法
s11d27 算法 一.理论 1.1 时间复杂度和空间复杂度的理论: 1)空间复杂度: 是程序运行所以需要的额外消耗存储空间,一般的递归算法就要有o(n)的空间复杂度了, 简单说就是递归集算时通常是反 ...
- Python__组合数据类型
组合数据:集合类型.序列类型(元组类型.列表类型).字典类型 集合: 定义:集合是多个元素的无序组合.(无序,唯一,Python中要求放入集合中的数据类型是不可变的). 集合用大括号 {}表示,元素间 ...
- 啰里吧嗦kafka
1.kafka是什么 kafka官网: http://kafka.apache.org/ kafka是一种高吞吐量的分布式发布订阅消息系统,用它可以在不同系统中间传递分发消息 2.zookeeper是 ...
- 关于Comparator和Comparable的理解
我们都知道,实现Comparator和Comparable这两个接口,可以实现对对象比较大小.那这个两个又有什么区别呢? comparator 1.接口类在java.util包里面,实现接口时需要导入 ...
- 使用JSON实现分页
使用JSON实现分页可直接用 Fenye.html <!DOCTYPE html> <html> <head> <title>JSON分页</ti ...
- 前端日报-20160527 underscore 源码解读
underscore 源码解读 API文档浏览器 JavaScript 中加号操作符细节 抛弃 jQuery,拥抱原生 JS 从 0 开始学习 GitHub 系列之「加入 GitHub」 js实现克隆 ...
- Https之SSL原理
一.HTTPS和SSL HTTP(Hyper TEXT Transfer Protocol超文本传输协议)是目前互联网上应用最为广泛的一种网络协议,用于在Web浏览器和网站服务器之间传递信息,但是HT ...
- linux 光盘yum源搭建
1.挂载光盘 2.进入 /etc/yum.repos.d 目录,修改其它配置文件后缀名 mv CentOS-Base.repo CentOS-Base.repo.bakmv CentOS-CR.rep ...