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的更多相关文章

  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 开发笔记:FM 电台模块 KT0803L

    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 开发笔记: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 ...

  9. 张高兴的 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 ...

随机推荐

  1. [Codeforces 932E]Team Work

    Description 题库链接 求 \[\sum_{i=1}^n C(n,i)\times i^k\] \(1\leq n\leq 10^9, 1\leq k\leq 5000\) Solution ...

  2. javaScript中用eval()方法转换json对象

    var u = eval('('+user+')'); 1.对于服务器返回的JSON字符串,如果jQuery异步请求没做类型说明,或者以字符串方式接受,那么需要做一次对象化处理,方式不是太麻烦,就是将 ...

  3. springboots Helloworld

    1.eclipse gradle 插件 HELP----MarketPlace----搜索 buildship点击安装 WINDOW----preferences--gradle 配置安装好的grad ...

  4. JavaScript 正则表达式RegExp 和字符串本身的正则表达式

    JavaScript 正则表达式 正则表达式(英语:Regular Expression,在代码中常简写为regex.regexp或RE)使用单个字符串来描述.匹配一系列符合某个句法规则的字符串搜索模 ...

  5. LinqProvider系列(三)如何实现自己的Linq Provider?

    这篇文章将在前人的肩上,继续完成实现Linq Provider的任务. 首先,我们列出linq语法的解析过程: linq本质上就是把我们惯用的语法糖,变成了一颗表达式树,然后由不同的linq Prov ...

  6. 双11抢券,写一个自动打开页面的html,仅仅是设定时间打开抢券的页面

    <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...

  7. 为Jquery类和Jquery对象扩展方法

    转:https://www.cnblogs.com/keyi/p/6089901.html jQuery为开发插件提拱了两个方法,分别是: JavaScript代码 jQuery.fn.extend( ...

  8. hdu Rescue 1242

    Rescue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  9. 使用DOM创建xml文件

    使用DOM创建xml文件 创建xml的代码如下: public class CreateXML { public static void main(String[] args) { DocumentB ...

  10. Glide填坑指南

    一.前言:再优秀的开源库都有坑要填 手上的项目使用的图片加载框架是:Universal-Image-Loader+业务需要定制化的一些代码.Universal-Image-Loader 这个框架是一个 ...