0

I am trying to build a mobile application which will be capable of firing different channels via Bluetooth HC-05 and Arduino UNO. We are getting IR codes from Android to Arduino through Bluetooth and firing via IR transmitter. It is working perfectly for all the channels, but when '0' is there in between a channel number, the digit followed by zero is not being detected by the set-top box.

I am sharing the Arduino program & the IR codes that are fired from Android app:

Program

#include <IRremote.h>

IRsend irsend;

void setup()
{
   // put your setup code here, to run once:
   Serial.begin(9600);
} 

void loop() {

   int khz = 0;
   char input = 0;  
   int data[55];
   int count=0;
   String temp;
   String numberSequence;
   int i;
   if (Serial.available()>0)
   {
       numberSequence=Serial.readStringUntil('|');
       Serial.println(numberSequence);
       temp.concat(numberSequence[0]);
       temp.concat(numberSequence[1]);

       khz=temp.toInt();
       temp="";
       Serial.print("Frequency in Khz:");
       Serial.println(khz);
       for(i=3;i<numberSequence.length();i++) {
          if( numberSequence.charAt(i) == ',' ){
             data[count]=temp.toInt();
             Serial.println(data[count]);
             temp="";
             count++;
          } 
          else 
          { 
             temp.concat(numberSequence[i]);
          }
       }
       Serial.println("Calling changeChannel");  
       irsend.sendRaw(data, sizeof(data) / sizeof(data[0]), khz);
       Serial.println("IR Transmitted");
   }
}

IR Codes:

Digit 1:
{37,2800,764,596,292,596,292,596,736,592,744,1040,292,592,296,596,296,596,292,592,296,596,292,596,292,596,292,596,296,592,292,596,296,592,296,592,296,596,292,600,292,592,292,596,296,596,292,596,292,1040,|}

Digit 2:
{37,2796,768,596,292,596,292,596,736,596,740,1040,292,592,300,592,296,592,296,592,296,596,292,596,292,596,296,592,296,592,296,592,296,592,296,592,296,592,300,592,296,592,296,592,296,596,296,1040,732,596,|}

Digit 3:
{37,2792,772,588,296,592,296,592,740,592,744,1040,296,592,296,592,296,592,296,592,296,592,300,592,296,592,296,592,296,596,292,596,292,596,296,592,296,592,296,592,296,596,292,592,300,588,300,1036,296,592,|}

Digit 4:
{37,2792,768,592,296,592,296,592,744,584,752,1032,300,588,300,592,296,592,296,592,300,588,300,588,300,588,300,588,300,592,296,588,304,588,300,588,300,592,296,592,300,588,300,588,300,1036,740,588,300,588,|}

Digit 5:
{37,2796,768,588,296,596,296,592,740,592,744,1040,292,596,292,596,292,596,292,592,300,592,296,592,296,592,296,592,296,596,292,596,296,592,296,592,296,592,296,592,296,596,292,592,300,1036,736,1040,|}

Digit 6:
{37,2800,764,592,292,596,296,592,740,592,744,1040,292,596,292,596,296,596,292,596,292,596,292,596,292,596,296,592,296,596,292,592,296,596,296,592,296,596,292,596,292,596,292,596,292,1044,288,596,736,592,|}

Digit 7:
{37,2792,768,592,296,592,296,592,740,596,740,1040,296,592,296,592,296,592,296,592,300,588,300,592,296,592,296,592,296,596,292,596,296,592,296,592,296,592,296,592,300,592,296,588,300,1040,292,592,296,592,|}

Digit 8:
{37,2800,764,596,292,592,296,592,740,592,744,1040,296,592,296,596,292,596,292,596,292,596,296,592,296,592,296,592,300,588,296,596,296,592,296,596,292,596,296,592,296,596,292,1040,736,592,296,592,296,592,|}

Digit 9:
{37,2796,768,592,292,596,292,592,740,592,744,1040,292,592,296,596,296,592,292,596,296,592,296,596,292,592,296,592,296,592,296,592,296,596,292,596,292,596,296,596,292,596,292,1040,732,596,292,1036,|}

Digit 0:
{37,2800,764,596,292,596,292,596,736,596,740,1040,292,600,292,592,296,596,292,596,292,596,292,600,288,600,292,596,292,596,292,596,292,596,296,592,296,592,296,596,292,600,288,596,296,596,292,596,292,596,292,596,|}

Any clues on why this is happening? Thanks.

migrated from electronics.stackexchange.com Jun 21 '17 at 1:46

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 1
    "when '0' is there in between a channel number..." - what does this mean exactly? – Bruce Abbott Jun 19 '17 at 19:52
  • if the channel number is 1308, '1','3', and '0' will fire. '8' won't. – BBHeeMAA Jun 20 '17 at 4:09
  • When you say 8 'won't fire' you mean the IR signal is transmitted but the set-top box doesn't respond, right? Your code appears to process all digits the same way, which suggests the problem is in the IR data. Can you compare it to the signal transmitted by the set-top box's remote? – Bruce Abbott Jun 20 '17 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy