Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Transmitter
- Before uploading these sketches to your Arduino boards, please install the "IRremote" library. You can find it in the Arduino Library Manager or on GitHub: https://github.com/z3t0/Arduino-IRremote
- Once you've installed the library, upload the "Transmitter" code to one Arduino board and the "Receiver" code to another Arduino board. Wire an infrared LED to the IR_LED_PIN (pin 3) on the transmitter board, and connect the HL-A838 module's output pin to the IR_RECEIVER_PIN (pin 11) on the receiver board. Also, connect the module's VCC and GND pins to the appropriate power and ground pins on the Arduino.
- The transmitter will send an NEC IR code (0x00FFA857) every 3 seconds, and the receiver will print the received signal's value on the Serial Monitor.
- */
- #include <IRremote.h>
- const int IR_LED_PIN = 3; // IR LED connected to pin 3
- IRsend irsend(IR_LED_PIN);
- void setup() {
- Serial.begin(9600);
- pinMode(IR_LED_PIN, OUTPUT);
- }
- void loop() {
- Serial.println("Sending IR signal...");
- irsend.sendNEC(0x00FFA857, 32); // Send a test NEC code (0x00FFA857)
- delay(3000); // Wait 3 seconds between signals
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement