前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >张高兴的 Windows 10 IoT 开发笔记:串口红外编解码模块 YS-IRTM

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

原创
作者头像
张高兴
发布2018-05-25 22:59:43
5800
发布2018-05-25 22:59:43
举报
文章被收录于专栏:张高兴的博客

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/IRTM

Image

YS-IRTM.jpg
YS-IRTM.jpg

Reference

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

Connect

  • RXD - UART0 TX (PIN 8)
  • TXD - UART0 RX (PIN 10)
  • VCC - 5V
  • GND - GND

Note

There is one Serial UART available on the RPi2/3: UART0

  • Pin 8 - UART0 TX
  • Pin 10 - UART0 RX

You need add the following capability to the Package.appxmanifest file to use Serial UART.

代码语言:txt
复制
<Capabilities>
    <DeviceCapability Name="serialcommunication">
        <Device Id="any">
            <Function Type="name:serialPort" />
        </Device>
    </DeviceCapability>
</Capabilities>

What Contains

In IRTM.cs file

代码语言:txt
复制
/// <summary>
/// Initialize YS-IRTM
/// </summary>
public async Task InitializeAsync();

/// <summary>
/// Send Order
/// </summary>
/// <param name="code">Order</param>
public async Task SendAsync(byte[] code);

/// <summary>
/// Read Order
/// </summary>
public async Task<byte[]> ReadAsync();

/// <summary>
/// Set YS-IRTM Address
/// </summary>
/// <param name="address">Address from 1 to FF</param>
public async Task SetAddressAsync(byte address);

/// <summary>
/// Set YS-IRTM Baud Rate
/// </summary>
/// <param name="rate">Baud Rate</param>
public async Task SetBaudRateAsync(IrtmBaudRate rate);

/// <summary>
/// Return YS-IRTM
/// </summary>
/// <returns>YS-IRTM</returns>
public SerialDevice GetDevice();

/// <summary>
/// Cleanup
/// </summary>
public void Dispose();

How to Use

  • First, you need to create a IRTM object. After that you should call InitializeAsync() to initialize.IRTM irtm = new IRTM(); await irtm.InitializeAsync();irtm.SendAsync(new byte[] { 0x01, 0x02, 0x03 });irtm.Dispose();
  • Second, SendAsync().
  • If you want to close the sensor, call Dispose().

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Image
  • Reference
  • Connect
  • Note
  • What Contains
  • How to Use
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档