Sub Process_Globals
Public sp As Serial
Public ssp As SoftwareSerial
Private astream As AsyncStreams
Private receivedChar As Byte
End Sub
Private Sub AppStart
sp.Initialize(9600)
astream.Initialize(sp.Stream, "Astream_NewData", "Astream_Error")
ssp.Initialize(9600, 12, 13)
astream.Initialize(ssp.Stream, "Astream_NewData", "Astream_Error")
End Sub
Sub Astream_NewData (Buffer() As Byte)
For Each char In Buffer
receivedChar = char
showNewData
Delay(500)
Next
End Sub
Sub AStream_Error
Log("error")
End Sub
Sub showNewData
Select receivedChar
Case 48 '0
RunNative("sendIR", 0x00) 'IQ 0 command
Case 49 '1
RunNative("sendIR", 0x01) 'IQ 1 command
Case 50 '2
RunNative("sendIR", 0x02) 'IQ 2 command
Case 51 '3
RunNative("sendIR", 0x03) 'IQ 3 command
Case 52 '4
RunNative("sendIR", 0x04) 'IQ 4 command
Case 53 '5
RunNative("sendIR", 0x05) 'IQ 5 command
Case 54 '6
RunNative("sendIR", 0x06) 'IQ 6 command
Case 55 '7
RunNative("sendIR", 0x07) 'IQ 7 command
Case 56 '8
RunNative("sendIR", 0x08) 'IQ 8 command
Case 57 '9
RunNative("sendIR", 0x09) 'IQ 9 command
Case 65 'A
RunNative("sendIR", 0x0C) 'IQ Power command
Case 66 'B
RunNative("sendIR", 0x0D) 'IQ Mute command
Case 67 'C
RunNative("sendIR", 0x0F) 'IQ Mute command
Case 68 'D
RunNative("sendIR", 0x10) 'IQ Vol+ command
Case 69 'E
RunNative("sendIR", 0x11) 'IQ Vol- command
Case 70 'F
RunNative("sendIR", 0x20) 'IQ Chn+ command
Case 71 'G
RunNative("sendIR", 0x21) 'IQ Chn- command
Case 72 'H
RunNative("sendIR", 0x28) 'IQ Fwd command
Case 73 'I
RunNative("sendIR", 0x29) 'IQ Rew command
Case 74 'J
RunNative("sendIR", 0x2C) 'IQ Play command
Case 75 'K
RunNative("sendIR", 0x30) 'IQ Pause command
Case 76 'L
RunNative("sendIR", 0x31) 'IQ Stop command
Case 77 'M
RunNative("sendIR", 0x37) 'IQ Record command
Case 78 'N
RunNative("sendIR", 0x38) 'IQ AV command
Case 79 'O
RunNative("sendIR", 0x4E) 'IQ Foxtel command
Case 80 'P
RunNative("sendIR", 0x54) 'IQ Setup command
Case 81 'Q
RunNative("sendIR", 0x58) 'IQ Up command
Case 82 'R
RunNative("sendIR", 0x59) 'IQ Down command
Case 83 'S
RunNative("sendIR", 0x5A) 'IQ Left command
Case 84 'T
RunNative("sendIR", 0x5B) 'IQ Right command
Case 85 'U
RunNative("sendIR", 0x5C) 'IQ Select command
Case 86 'V
RunNative("sendIR", 0x6D) 'IQ Red command
Case 87 'W
RunNative("sendIR", 0x6E) 'IQ Green command
Case 88 'X
RunNative("sendIR", 0x6F) 'IQ Yellow command
Case 89 'Y
RunNative("sendIR", 0x70) 'IQ Blue command
Case 90 'Z
RunNative("sendIR", 0x81) 'IQ Help command
Case 97 'a
RunNative("sendIR", 0x83) 'IQ Back command
Case 98 'b
RunNative("sendIR", 0xCC) 'IQ TV Guide command
Case 99 'c
RunNative("sendIR", 0xD5) 'IQ Box Office command
Case 100 'd
RunNative("sendIR", 0xF4) 'IQ Planner command
Case 101 'e
RunNative("sendIR", 0xFD) 'IQ Active command
End Select
End Sub
#if C
#include <skIRremote.h>
IRsend irsend;
void sendIR(B4R::Object* o) {
irsend.sendFox(o->toULong()); // Send IQ command via IR
}
#End if