B4R Tutorial Controlling DSTV decoder from Android device via Nano and HC-05 bluetooth module

Just for the fun of it. Can now control my Digital Satellite TV decoder from anywhere in my house....
Nano connected to the HC-05 module
B4A app connects to the HC-05 and sends the B4A "button codes" to the HC-05
HC-05 sends the "button codes" to the Nano
Nano fires the applicable IR codes to the DSTV decoder via an IR led
The "Hex Codes" are stored in the program memory of the Nano (PROGMEM) - else it runs OOM
The RED led is purely there as an indicator when the IR led sends the control codes to the DSTV decoder
Note: The RX pin of the HC-05 requires max 3.3V. See the voltage divider between pin D11 of the Nano, the RDX pin of the HC-05, and GND



WiringDSTV.png



Libraries used:
libraries.png


Take note that by default the library uses pin D3 (i.e the "S" pin of the IR module is connected to D3 of the Nano)

B4A UI (connected to the HC-05):
dstv_remote_ui.png


B4R sample code:
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Private SoftwareSerial1 As SoftwareSerial
    Private astream As AsyncStreams
    Private leds(1) As Pin
    Dim program As Byte = 0
    
    Dim freq As UInt
        
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    leds(0).Initialize(leds(0).A0, leds(0).MODE_OUTPUT)
    SoftwareSerial1.Initialize(9600, 10, 11) 'software serial port on pins 10 and 11
    astream.Initialize(SoftwareSerial1.Stream, "astream_NewData", Null)
End Sub

Sub AStream_NewData (Buffer() As Byte)
    
    Log("memory = ", AvailableRAM)
    For i = 0 To Buffer.Length - 2 Step 2
        If Buffer(i + 1) = 1 Then
            program = 1
            detail
        else If Buffer(i + 1) = 2 Then
            program = 2
            detail
        else If Buffer(i + 1) = 3 Then
            program = 3
            detail
            
        else If Buffer(i + 1) = 4 Then
            program = 4
            detail
            
        else If Buffer(i + 1) = 5 Then
            program = 5
            detail

        else if Buffer(i + 1) = 6 Then
            program = 6
            detail
            
        else if Buffer(i + 1) = 7 Then
            program = 7
            detail
            
        else if Buffer(i + 1) = 8 Then
            program = 8
            detail
            
        else if Buffer(i + 1) = 9 Then
            program = 9
            detail
        
        else if Buffer(i + 1) = 10 Then
            program = 10
            detail
            
        else if Buffer(i + 1) = 11 Then
            program = 11
            detail
            
        else if Buffer(i + 1) = 12 Then
            program = 12
            detail
            
        else if Buffer(i + 1) = 13 Then
            program = 13
            detail
            
        else if Buffer(i + 1) = 14 Then
            program = 14
            detail

        else if Buffer(i + 1) = 15 Then
            program = 15
            detail
            
        else if Buffer(i + 1) = 16 Then
            program = 16
            detail
            
        else if Buffer(i + 1) = 17 Then
            program = 17
            detail
            
        else if Buffer(i + 1) = 18 Then
            program = 18
            detail
            
        else if Buffer(i + 1) = 19 Then
            program = 19
            detail
            
        else if Buffer(i + 1) = 20 Then
            program = 20
            detail
            
        else if Buffer(i + 1) = 21 Then
            program = 21
            detail
            
        else if Buffer(i + 1) = 22 Then
            program = 22
            detail
            
        else if Buffer(i + 1) = 23 Then
            program = 23
            detail
            
        else if Buffer(i + 1) = 24 Then
            program = 24
            detail
            
        else if Buffer(i + 1) = 25 Then
            program = 25
            detail
            
        else if Buffer(i + 1) = 26 Then
            program = 26
            detail
            
        else if Buffer(i + 1) = 27 Then
            program = 27
            detail
            
        else if Buffer(i + 1) = 28 Then
            program = 28
            detail
            
        else if Buffer(i + 1) = 29 Then
            program = 29
            detail
            
        else if Buffer(i + 1) = 30 Then
            program = 30
            detail
            
        else if Buffer(i + 1) = 31 Then
            program = 31
            detail
            
        else if Buffer(i + 1) = 32 Then
            program = 32
            detail
            
        else if Buffer(i + 1) = 33 Then
            program = 33
            detail
            
        else if Buffer(i + 1) = 34 Then
            program = 34
            detail
            
        else if Buffer(i + 1) = 35 Then
            program = 35
            detail
            
        else if Buffer(i + 1) = 36 Then
            program = 36
            detail
            
        else if Buffer(i + 1) = 37 Then
            program = 37
            detail
            
        else if Buffer(i + 1) = 38 Then
            program = 38
            detail
            
        else if Buffer(i + 1) = 39 Then
            program = 39
            detail
            
        End If       
    Next
    
End Sub


private Sub detail
    Dim data(68) As UInt
    Dim prup(72) As UInt
    For i = 0 To 71
        prup(i) = GetUint(i)
    Next
    freq = 1000000/(prup(1)*0.241246)/1000
    Dim timing As Float = 1/freq*1000
    For i = 4 To prup.Length - 2
        data(i-4) = prup(i) * timing
    Next
    RunNative("send_code", data)
    leds(0).DigitalWrite(True)
    Delay(200)
    leds(0).DigitalWrite(False)
    
End Sub

Private Sub GetUint(Index As UInt) As UInt
    Index = Index * 2
    Dim low As Byte = RunNative("getdata", Index)
    Index = Index + 1
    Dim high As Byte = RunNative("getdata", Index)
    Return Bit.Or(low, Bit.ShiftLeft(high, 8))
End Sub

#If C

    #include <avr/pgmspace.h>
    const PROGMEM uint16_t progup[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DD
    };

    const PROGMEM uint16_t progdown[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };

    const PROGMEM uint16_t volup[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };

    const PROGMEM uint16_t voldown[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };

    const PROGMEM uint16_t pwr[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };

    const PROGMEM uint16_t mute[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };
    
    const PROGMEM uint16_t info[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F ,0x0098 ,0x0013 ,0x0013 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0013 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0039 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0013 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0039 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0039 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x0013 ,0x05DF
    };   
    
    const PROGMEM uint16_t ex[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t ok[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t zero[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };       
    
    const PROGMEM uint16_t one[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t two[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t three[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };           
    
    const PROGMEM uint16_t four[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };       
    
    const PROGMEM uint16_t five[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };       
    
    const PROGMEM uint16_t six[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };   
    
    const PROGMEM uint16_t seven[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };   
    
    const PROGMEM uint16_t eight[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };
    
    const PROGMEM uint16_t nine[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DC
    };   
    
    const PROGMEM uint16_t up[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t down[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t left[] = { //change the data here
    0x0000, 0x006E, 0x0000, 0x0022, 0x012D, 0x0096, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05D1
    };       
    
    const PROGMEM uint16_t right[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t options[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t dstv[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DE
    };           
    
    const PROGMEM uint16_t help[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t playlist[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t boxoffice[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t tv[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x0130, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t tvguide[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t alt[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };           
    
    const PROGMEM uint16_t catchup[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };       
    
    const PROGMEM uint16_t arc[] = { //change the data here
    0x0000, 0x006D, 0x0022, 0x0000, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x5F04
    };   
    
    const PROGMEM uint16_t pauseplay[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t record[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0097, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DD
    };       
    
    const PROGMEM uint16_t stp[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t search[] = { //change the data here
    0x0000, 0x006E, 0x0000, 0x0022, 0x012C, 0x0096, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0038, 0x0013, 0x0038, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05D1
    };   
    
    const PROGMEM uint16_t ff[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012E, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };   
    
    const PROGMEM uint16_t rew[] = { //change the data here
    0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DF
    };                       
                    
    
    
    IRsend irsend;
    B4R::Object beo1;

    void send_code(B4R::Object* o){
        B4R::Array* b = (B4R::Array*)B4R::Object::toPointer(o);
        UInt* c = (UInt*)b->data;
        irsend.sendRaw(c, 68, b4r_main::_freq);
    }

    B4R::Object* getdata(B4R::Object* o) {
       if (b4r_main::_program == 1)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)progup + o->toLong()));
       if (b4r_main::_program == 2)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)progdown + o->toLong()));   
       if (b4r_main::_program == 3)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)volup + o->toLong()));                   
       if (b4r_main::_program == 4)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)voldown + o->toLong()));       
       if (b4r_main::_program == 5)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)pwr + o->toLong()));       
       if (b4r_main::_program == 6)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)mute + o->toLong()));                                       
       if (b4r_main::_program == 7)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)info + o->toLong()));   
       if (b4r_main::_program == 8)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)ex + o->toLong()));       
       if (b4r_main::_program == 9)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)ok + o->toLong()));             
       if (b4r_main::_program == 10)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)one + o->toLong()));       
       if (b4r_main::_program == 11)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)two + o->toLong()));       
       if (b4r_main::_program == 12)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)three + o->toLong()));   
       if (b4r_main::_program == 13)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)four + o->toLong()));   
       if (b4r_main::_program == 14)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)five + o->toLong()));
       if (b4r_main::_program == 15)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)six + o->toLong()));   
       if (b4r_main::_program == 16)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)seven + o->toLong()));   
       if (b4r_main::_program == 17)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)eight + o->toLong()));
       if (b4r_main::_program == 18)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)nine + o->toLong()));                                                                   
       if (b4r_main::_program == 19)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)zero + o->toLong()));       
       if (b4r_main::_program == 20)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)up + o->toLong()));
       if (b4r_main::_program == 21)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)down + o->toLong()));
       if (b4r_main::_program == 22)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)left + o->toLong()));
       if (b4r_main::_program == 23)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)right + o->toLong()));             
       if (b4r_main::_program == 24)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)options + o->toLong()));       
       if (b4r_main::_program == 25)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)dstv + o->toLong()));   
       if (b4r_main::_program == 26)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)help + o->toLong()));   
       if (b4r_main::_program == 27)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)playlist + o->toLong()));   
       if (b4r_main::_program == 28)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)boxoffice + o->toLong()));     
       if (b4r_main::_program == 29)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)tv + o->toLong()));   
       if (b4r_main::_program == 30)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)tvguide + o->toLong()));   
       if (b4r_main::_program == 31)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)alt + o->toLong()));   
       if (b4r_main::_program == 32)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)catchup + o->toLong()));   
       if (b4r_main::_program == 33)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)arc + o->toLong()));   
       if (b4r_main::_program == 34)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)pauseplay + o->toLong()));   
       if (b4r_main::_program == 35)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)record + o->toLong()));   
       if (b4r_main::_program == 36)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)stp + o->toLong()));   
       if (b4r_main::_program == 37)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)search + o->toLong()));       
       if (b4r_main::_program == 38)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)rew + o->toLong()));       
       if (b4r_main::_program == 39)
          return beo1.wrapNumber(pgm_read_byte_near((Byte*)ff + o->toLong()));                                                                         
                                                                                                                                    
    }
    
#End If
Thank you @Erel for your guidance here

Code can in all probability be neatened up...but it is working as it is at present.

B4A and B4R projects attached.
 

Attachments

  • b4aHC-05.zip
    31.2 KB · Views: 403
  • b4rHC05.zip
    2.9 KB · Views: 390

rabbitBUSH

Well-Known Member
Licensed User
Dear @Johan Schoeman

Thanks for your contributions, some of which have assisted me greatly.

Having NOTHING like the experience and skill you have at this sort of programming, and, having seen your multiple IF..Then..Else IF..then statement, I wondered if there is a technical reason why the following would not work? Assuming, of course, I have understood Buffer and for loop purpose. [[and also have this code correct]]

Select Case attempt:
For i = 0 To Buffer.Length - 2 Step 2
    Select (Buffer (i + 1))
        case 1
                program = 1   
        case 2
                program = 2
        .
        .
        case 39
                program = 39
    End Select

    detail
next
 

Johan Schoeman

Expert
Licensed User
Longtime User
Dear @Johan Schoeman

"......having seen your multiple IF..Then..Else IF..then statement, I wondered if there is a technical reason why the following would not work? Assuming, of course, I have understood Buffer and for loop purpose. [[and also have this code correct]]..."

Select Case attempt:
For i = 0 To Buffer.Length - 2 Step 2
    Select (Buffer (i + 1))
        case 1
                program = 1
        case 2
                program = 2
        .
        .
        case 39
                program = 39
    End Select

    detail
next

Using the Select statement vs If..Then...Else...in my sample code in post #1 increases the usage of the program storage space from 18 104 bytes to 21 208 bytes. It is 3 104 bytes more = 10.1% more of the available program storage space which on the Nano is limited to 30 720 bytes. But using the Select statement in your proposal above does work at the expense of using more of the available RAM

See the post here:
 
Last edited:

rabbitBUSH

Well-Known Member
Licensed User
That's a bit surprising and interesting. I remember being told SELECT /in other languages/ is more efficient, and certainly more readable. Its also supposed to take out the mission of getting those if .. then.. elseif.. sequences logically correct. //big thing in excel this//.

Seems there are a few things arduino Have to work out. Printf is one that may have been corrected. Since C seems to be well associated with arduino, and Select in C is supposed to be more code efficient...one would think......

Will look at the link In due course...it will be relevant in a current project.

Thanks.....
 

Johan Schoeman

Expert
Licensed User
Longtime User
That's a bit surprising and interesting. I remember being told SELECT /in other languages/ is more efficient, and certainly more readable. Its also supposed to take out the mission of getting those if .. then.. elseif.. sequences logically correct. //big thing in excel this//.

Seems there are a few things arduino Have to work out. Printf is one that may have been corrected. Since C seems to be well associated with arduino, and Select in C is supposed to be more code efficient...one would think......

Will look at the link In due course...it will be relevant in a current project.

Thanks.....
I try to steer clear of using nested IF's in Excel and rather use Array Formulas - in MHO one of the best and most powerful features in Excel.
 

rabbitBUSH

Well-Known Member
Licensed User
Hehe hehe I steer clear of excel if I Can....
The link was interesting conversation and back in 2010 nog al. Have seen other threads suggesting arduino is slow to respond on some stuff.

Remember DSTV gets nasty when something comes along to challenge their monopoly grip /just like trump/

Stay safe in Durbs.
 

hatzisn

Well-Known Member
Licensed User
Longtime User
Just for the fun of it. Can now control my Digital Satellite TV decoder from anywhere in my house....
............


View attachment 104944

Just out of curiosity what is the maximum distance the IR led works to send the IR codes to the receiver? And further more what is the correct way to choose a led that will work from a higher distance let's say 8-10 meters?
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
In my usage case the little breadboard with the circuit is standing at the decoder due to the distance limitation of the IR LED. But I connect the the HC-05 via Bluetooth via the mobile device from anywhere in the house and therfore don't rely on the distance of the IR LED.
 

Daestrum

Expert
Licensed User
Longtime User
As you check values between 1 and 39 in your if statements could you not just use
B4X:
...
If buffer(i + 1)> 0  And buffer(i + 1) < 40 then ' values 1 to 39
      program = buffer(i + 1)
      detail
End If
...
(that should save some bytes)
 

Firdoshnd

New Member
Hi Johan , Thanks for all your great projects, I am trying to make a remote bender/extender using an Arduino Nano with IR receiver & IR Tx module, to control an Explorer decoder which is in a closed cupboard. May you guide me on how to set up the hardware do I need two Arduino's one for receiver and one for TX? I have gone thru many videos on you tube but non show using existing remote to relay the IR signal. The project above is great but I do not want to use a cell phone. Your guidance would be greatly appreciated and prepared to pay you a fee up front for this. Thanks..
 
Top