Go Down

Topic: having trouble using IR blaster to send codes (Read 316 times) previous topic - next topic

Vivekjamy

i am doing a project on gesture control.for this i am using accelerometer.I have successfully decoded remote HEX codes and programmed accelerometer.Now,I want to integrate accelerometer with IR blaster to send function of a button.this is my code

#include <IRremote.h>


IRsend irsend;

const int b1  = 4;  //bluetooth
const int b2  = 5;  //mute

int LED_BUILTIN = 3;
#define 1004C;
#define 1004D;
void setup() {
 pinMode(LED_BUILTIN, OUTPUT);
 pinMode(b1, INPUT);
 pinMode(b2, INPUT);

}

void loop() {

   if (digitalRead(b1) == 4) {
     
     delay(50);
     irsend.sendRC6(0x1004C, 14);
   }

   if (digitalRead(b2) == 5) {
   
     delay(50);
     irsend.sendRC6(0x1004D, 14);
   }

 }


IR_Remote:10: error: macro names must be identifiers

#define 1004C;

        ^

IR_Remote:11: error: macro names must be identifiers

#define 1004D;

        ^

Using library IRremote at version 2.0.1 in folder: C:\Users\Multimedia\Downloads\arduino-nightly-windows\arduino-nightly\libraries\IRremote
exit status 1
macro names must be identifiers
Help me

groundFungus

#1
Mar 02, 2018, 07:38 pm Last Edit: Mar 02, 2018, 07:42 pm by groundFungus
Code: [Select]
#define 1004C;
#define 1004D;


Identifiers can't start with a number.  You can do something like
Code: [Select]

#define IRcode1 0x1004D


Then where ever IRcode1 is used it will be replaced with 0x1004D.
The define directive.


Code: [Select]
if (digitalRead(b1) == 4) {

The digitalRead() function returns 0 or 1( LOW or HIGH).   See a problem with that if?

Vivekjamy

Thanks for your information.I am having problem in sending the remote button code to the tv through arduino.Is there any specific IR is used for remotes?? Can you suggest codes to transmit Ir signal.

wvmarle

Yes: every device has their own set of codes.
Find the product number of your specific device, and you may be able to find a list of codes for it online. Otherwise, you need a decoder: something that receives the commands from your original remote and can show you which codes are actually transmitted.
On top of that, there are various protocols and modulations possible.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Vivekjamy

hi i have successfully controlled tv using raw codes.now, i am facing problem while decoding raw codes of ac remote.i am using arduino uno and tsop1738 receiver.please help me.

wvmarle

Why don't you start by describing, in detail, what you tried, what worked, what didn't work, what you're trying to achieve, and of course code and other details.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up