Send IR values using infrared emitter led on Arduino
12,576
i Have looked at the IRRemote.cpp library you refereed to and in the header file you can see that each Arduino board have a unique PWM
pin that is used to transmit infrared data so use PWM 9
it's assured to work on Arduino Mega
Related videos on Youtube
Author by
Haitham Sy
Updated on June 04, 2022Comments
-
Haitham Sy almost 2 years
i have Arduino Mega and an IR Emitting LED and i want to send data "Hex Data" that i choose using this LED and i have tried the IRRemote Library and i have successfully used the
IRrecv
class, but when usingIRsend
i didn't get any signal and have tried to look at the led through the mobile camera
the IR Emitter Pin is PWM 3 and have connected it to 3.3V once and to 5V once#include <IRremote.h> IRsend irsend; void setup() { Serial.begin(9600); } void loop() { if (Serial.read() != -1) { for (int i = 0; i < 3; i++) { irsend.sendSony(0xa90, 12); // Sony TV power code delay(40); } } }
and for the receiver:
#include <IRremote.h> int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume(); // Receive the next value } }
any help is appreciated :) Hiso
-
Werner Kvalem Vesterås over 10 yearsWhat type of IR receiver are you using?
-
Haitham Sy over 10 years@WernerVesterås this is the datasheet arduino-info.wikispaces.com/file/view/IR-Receiver-AX-1838HS.pdf
-
Werner Kvalem Vesterås over 10 yearsAccording to the troubleshooting guide, the LED on pin 13 (the onboard LED) will blink when IR is received. Does this happen?
-
Haitham Sy over 10 years@WernerVesterås when i use the receive example alone the light blinks but when combing the two examples together the LED stops blinking
-
praks411 over 10 yearsThis could hardware problem. Try changing the LED and check if it is the same PWM pin used in the library. You may also want to increase the delay to 100 from 40 as per example.
-