Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created May 10, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/8cf578a56c52bdc295601f4c68e8eeff to your computer and use it in GitHub Desktop.
Save JeffersGlass/8cf578a56c52bdc295601f4c68e8eeff to your computer and use it in GitHub Desktop.
#include <IRLibSendBase.h> //We need the base code
#include <IRLib_P08_Samsung36.h> //Only use Samsung sender
#include <IRLibCombo.h>
IRsend mySender;
const int NUMKEYS = 15;
//play, stop, pause, skip forward, skip backward, rewind, fast forward
//left, up, right, down, disc menu, menu, return, exit
String keys[NUMKEYS] = {"play", "stop", "sf", "sb", "rewind", "ff",
"left", "up", "right", "down", "dm", "menu",
"return", "exit"};
uint32_t transmitValues[NUMKEYS] = {0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000};
void setup() {
Serial.begin(9600);
while (!Serial); //delay for Leonardo
Serial.println(F("Enter a serial command to send remote commands"));
delay(100);
}
void loop() {
if (Serial.available()) {
//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.
String input = Serial.readString();
bool cmdSent = false;
for (int i = 0; i < NUMKEYS; i++){
if (cmdSent == false && input.equals(keys[i])){
mySender.send(SAMSUNG36, transmitValues[i]);
Serial.print(F("Sent "));
Serial.print(keys[i]);
Serial.print(" command in index ");
Serial.println(i);
cmdSent = true;
Serial.flush();
break;
}
}
if (cmdSent == false) Serial.println(F("Got unknown command, no signal sent."));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment