I'm working on a project where I can use an IR remote to hook up to my PC and control it because I have a projector connected to it that I want a remote for. I've figured out all of the IR remote stuff and have also been able to configure my Arduino UNO as an HID keyboard (I know there are better solutions for HID devices than Arduino UNO but the way I want this set up makes it so I have to use an UNO). However when I try to send key inputs to my PC it acts like its pressing the Control button (for example if I press A on my actual keyboard after pressing a button on the remote it selects everything on the page I am currently on). I've tried a bunch of different keycodes and looked at other people's code and couldn't find where I am going wrong here is the code I have for my project so far:
#include <IRremote.hpp>
#include <HID.h>
#include <IRremote.h>
int RECV_PIN = 7;
uint8_t buf[8] = { 0 };
void setup() {
Serial.begin(9600);
IrReceiver.begin(RECV_PIN, ENABLE_LED_FEEDBACK);
delay(200);
}
void loop(){
if (IrReceiver.decode()) {
int i;
int command = IrReceiver.decodedIRData.command;
IrReceiver.stop();
switch (command) {
case 70:
Serial.println("Volume +");
buf[2] = 0x80;
Serial.write(buf, 8);
break;
/*
There are a bunch more case statements with different IR commands that
correlate to functions I want the remote to do
*/
}
releaseKey();
delay(500);
IrReceiver.start(8000);
IrReceiver.resume();
}
}
void releaseKey() {
buf[0] = 0;
buf[2] = 0;
Serial.write(buf, 8);
}