rrx.Connect();
// Use the RRX a bit
Console
.WriteLine(
$"Using RedRat-X '
{rrxLi.Name}
'"
);
Console
.WriteLine(
$"Firmware version:
{rrx.FirmwareVersion}
"
);
// Blink the lights a few times
Console
.WriteLine(
"Blinking the LEDs..."
);
for
(
var
i = 0; i < 5; i++ )
{
rrx.Blink();
Thread
.Sleep( 750 );
}
rrx.Disconnect();
6.3
IR Signal Output
The RedRat-X has four IR outputs, which in code are referred to as outputs 1 to 4:
Output Number
Function
1
Output port 1 on back of case
2
Output port 2 on back of case
3
Output port 3 on back of case
4
Front IR blaster
6.3.1
Using the Front IR Blaster
To make the API’s use similar to that of the RedRat3-II, if no output ports are enabled and the simple
synchronous
OutputModulatedSignal
method is used, this will transmit the signal via the front blaster.
// Output an IR signal via the blaster
rrx.OutputModulatedSignal( sig );
Console
.WriteLine(
"IR out via blaster using sync API"
);
The async API can also be used where higher IR output throughput is required and concurrent IR
transmission is needed from the rear IR ports and the blaster. The code below will output an IR signal 5
times from the front blaster:
// Using the ASYNC API, all ports need to be explicitly set
var
opList =
new
OutputList
{
new
OutputPort
(
RedRatX
.IR_BLASTER_PORT, 60 ) };
var
mutex =
new
ManualResetEvent
(
false
);
for
(
var
i = 0; i < 5; i++)
{
rrx.OutputIRPacketAsync(GetSignal(), opList, 100,
null
, ar =>
{
Console
.WriteLine(
$"IR out via blaster using async API."
);
mutex.Set();
});
mutex.WaitOne();
// Wait for IR output completion
Thread
.Sleep(750);
// Wait a bit longer
}
Содержание RedRat-X
Страница 1: ...The RedRat X Integration Guide ...