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
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.
What Contains
In IRTM.cs file
///
/// Initialize YS-IRTM
///
public async Task InitializeAsync();
///
/// Send Order
///
/// Order
public async Task SendAsync(byte[] code);
///
/// Read Order
///
public async Task ReadAsync();
///
/// Set YS-IRTM Address
///
/// Address from 1 to FF
public async Task SetAddressAsync(byte address);
///
/// Set YS-IRTM Baud Rate
///
/// Baud Rate
public async Task SetBaudRateAsync(IrtmBaudRate rate);
///
/// Return YS-IRTM
///
/// YS-IRTM
public SerialDevice GetDevice();
///
/// Cleanup
///
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();
- Second, SendAsync().
irtm.SendAsync(new byte[] { 0x01, 0x02, 0x03 });
- If you want to close the sensor, call Dispose().
irtm.Dispose();