Dependancies
Pre-requisites
Buy the components
ir-emitter.ino
#include <IRLibAll.h>
IRrecvPCI myReceiver(2); // Arduino UNO PIN 2
IRdecode myDecoder;
IRsend mySender;
void setup() {
Serial.begin(9600);
myReceiver.enableIRIn();
Serial.println("Ready to receive IR signals...");
Serial.println("Ready to receive character into the serial monitor...");
}
void loop() {
if (myReceiver.getResults()) {
myDecoder.decode();
myDecoder.dumpResults(true);
myReceiver.enableIRIn();
}
// Send a character into the serial monitor
if (Serial.read() != -1) {
// Decoded NEC(1): Value:CE01F Adrs:0 (32 bits)
mySender.send(NEC, 0xce01f, 32); // Get the HEX code with IR receiver
Serial.println("Sent Eco Blank to the projector");
}
}
.PHONY: lint compile upload clean
lint:
cpplint --extensions=ino --filter=-legal/copyright *.ino
compile:
arduino-cli compile --fqbn arduino:avr:uno ./
upload:
arduino-cli upload -p /dev/cu.usbmodem14* --fqbn arduino:avr:uno ./
clean:
rm -f .*.hex
rm -f .*.elf
flash: lint compile upload clean
Get the HEX code to emit using the IR receiver program. This code contains both IR receiver and IR emitter logic.