Hi, I am relatively new to arduino but can get every grove module I own to work and write basic if statements to do most things I need, but i am struggling with the Grove IR emitter. I can get the reciever to work fine by pointing remotes etc at it and capturing data using the raw recieve example at the Grove page - https://wiki.seeedstudio.com/Grove-Infrared_Emitter/
however no matter what i do i cannot get the rawSend or the Sony example send to work. I have tried connecting a separate arduino board to my Com port to pick up signals and pointing the Emitter at it and it never picks it up. I have tried to connect to ports 2 and 3. I am using Arduino Mega 2560.
I have just about tried using every IR library possible and have bought another emitter sensor thinking mine was faulty.
I am using this code on the example link and have tried RawSend too, it seems very basic but being a relative noobie i wonder if i have left something out -
| /* send.ino Example sketch for IRLib2 | |
|---|---|
| * Illustrates how to send a code. | |
| */ | |
| #include <IRLibSendBase.h> // First include the send base | |
| //Now include only the protocols you wish to actually use. | |
| //The lowest numbered protocol should be first but remainder | |
| //can be any order. | |
| #include <IRLib_P01_NEC.h> | |
| #include <IRLib_P02_Sony.h> | |
| #include <IRLibCombo.h> // After all protocols, include this | |
| // All of the above automatically creates a universal sending | |
| // class called “IRsend” containing only the protocols you want. | |
| // Now declare an instance of that sender. | |
| IRsend mySender; | |
| #define IR_SEND_PWM_PIN D3 | |
| void setup() { | |
| Serial.begin(9600); | |
| delay(2000); while (!Serial); //delay for Leonardo | |
| Serial.println(F(“Every time you press a key is a serial monitor we will send.”)); | |
| } | |
| void loop() { | |
| if (Serial.read() != -1) { | |
| //send a code every time a character is received from the | |
| // serial port. You could modify this sketch to send when you | |
| // push a button connected to an digital input pin. | |
| //Substitute values and protocols in the following statement | |
| // for device you have available. | |
| mySender.send(SONY,0xa8bca, 20);//Sony DVD power A8BCA, 20 bits | |
| //mySender.send(NEC,0x61a0f00f,0);//NEC TV power button=0x61a0f00f | |
| Serial.println(F(“Sent signal.”)); | |
| } | |
| } |