#Region Project Notes
'
'V2 Changed from using inline C by updating rIRremote library from 1.00 to 1.01 to implement sendFox
' by including relevant parts of skIRemote library referenced here: http://sikkits.com/uncategorized/android-phone-bluetooth-tv-remote/
'V1 Receives a code attibuted to each Foxtel remote key via Bluetooth and transmits appropriate Foxtel remote key IR code with IRsend
'
'Hardware: Duinotech Classic (UNO)
' HM-10 Bluetooth module
'
'Wiring: An IR LED in series with a 180r resistor must be connected to Arduino PWM pin 3 and GND. (Long LED lead To +ve)
' Bluetooth module Tx to Arduino pin 12 and Rx to Arduino pin 13
' If an IR emmitter such as Jaycar AR1811 is to be affixed directly to the Foxtel box or TV, the 180r restistor should be increased to 1.2kr
'
'Setup: With bi-directional serial connection to HM-10 send:
' AT+NAMEFoxtelRemote to set name
' AT+NOTI0 to disable notifications so AT+CONN and AT+LOST are not sent & so do not affect commands sent by IR
'
#End Region
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
Public sp As Serial
Public ssp As SoftwareSerial
Private astream As AsyncStreams
Private receivedChar As Byte
Private irsend As IrSend
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")
Log("AppStart")
End Sub
Sub Astream_NewData (Buffer() As Byte)
Log("Buffer: ", Buffer)
For Each char In Buffer
receivedChar = char
sendNewData
Delay(500)
Next
End Sub
Sub AStream_Error
Log("error")
End Sub
Sub sendNewData
Log("Sending receivedChar: ", receivedChar)
Select receivedChar
'Foxtel commands
Case 48 '0
irsend.SendFox(0x00) 'IQ 0 command
Case 49 '1
irsend.SendFox(0x01) 'IQ 1 command
Case 50 '2
irsend.SendFox(0x02) 'IQ 2 command
Case 51 '3
irsend.SendFox(0x03) 'IQ 3 command
Case 52 '4
irsend.SendFox(0x04) 'IQ 4 command
Case 53 '5
irsend.SendFox(0x05) 'IQ 5 command
Case 54 '6
irsend.SendFox(0x06) 'IQ 6 command
Case 55 '7
irsend.SendFox(0x07) 'IQ 7 command
Case 56 '8
irsend.SendFox(0x08) 'IQ 8 command
Case 57 '9
irsend.SendFox(0x09) 'IQ 9 command
Case 65 'A
irsend.SendFox(0x0C) 'IQ Power command
Case 66 'B
irsend.SendFox(0x0D) 'IQ Mute command
Case 67 'C
irsend.SendFox(0x0F) 'IQ Info command
Case 68 'D
irsend.SendFox(0x10) 'IQ Vol+ command
Case 69 'E
irsend.SendFox(0x11) 'IQ Vol- command
Case 70 'F
irsend.SendFox(0x20) 'IQ Chn+ command
Case 71 'G
irsend.SendFox(0x21) 'IQ Chn- command
Case 72 'H
irsend.SendFox(0x28) 'IQ Fwd command
Case 73 'I
irsend.SendFox(0x29) 'IQ Rew command
Case 74 'J
irsend.SendFox(0x2C) 'IQ Play command
Case 75 'K
irsend.SendFox(0x30) 'IQ Pause command
Case 76 'L
irsend.SendFox(0x31) 'IQ Stop command
Case 77 'M
irsend.SendFox(0x37) 'IQ Record command
Case 78 'N
irsend.SendFox(0x38) 'IQ AV command
Case 79 'O
irsend.SendFox(0x4E) 'IQ Foxtel command
Case 80 'P
irsend.SendFox(0x54) 'IQ Setup command
Case 81 'Q
irsend.SendFox(0x58) 'IQ Up command
Case 82 'R
irsend.SendFox(0x59) 'IQ Down command
Case 83 'S
irsend.SendFox(0x5A) 'IQ Left command
Case 84 'T
irsend.SendFox(0x5B) 'IQ Right command
Case 85 'U
irsend.SendFox(0x5C) 'IQ Select command
Case 86 'V
irsend.SendFox(0x6D) 'IQ Red command
Case 87 'W
irsend.SendFox(0x6E) 'IQ Green command
Case 88 'X
irsend.SendFox(0x6F) 'IQ Yellow command
Case 89 'Y
irsend.SendFox(0x70) 'IQ Blue command
Case 90 'Z
irsend.SendFox(0x81) 'IQ Help command
Case 97 'a
irsend.SendFox(0x83) 'IQ Back command
Case 98 'b
irsend.SendFox(0xCC) 'IQ TV Guide command
Case 99 'c
irsend.SendFox(0xD5) 'IQ Box Office command
Case 100 'd
irsend.SendFox(0xF4) 'IQ Planner command
Case 101 'e
irsend.SendFox(0xFD) 'IQ Active command
'TV commands
Case 112 'p
irsend.SendPanasonic(0x4004, 0x100BCBD) 'Panasonic power command
Case 115 's
irsend.sendSAMSUNG(0xE0E0D12E, 32) 'Samsung power command
Case 105 'i
irsend.sendSAMSUNG(0xE0E0D12E, 32) 'Samsung HDMI command
Case 104 'h
irsend.sendNEC(0x20DF10EF, 32) 'Hisense power command using NEC protocol
End Select
End Sub