Hello all,
I am not new to Arduino programming but I am very much a newbie. I am trying design a very simple remote for my elderly mother who has severe Alzheimers and can not understand how to use her TV remote anymore. I just want to create a one button remote to turn on and off her TV, that's it. We will set her TV to a safe channel so that she can turn it on to watch something if we are not there to help her.
I am using the IRLib2 library and have a working code although I'm sure there is a better way to go about it. I am using the protocol captured from her current remote. Any suggestions would be welcome and very much appreciated.
#include <IRLibSendBase.h> //We need the base code
#include <IRLib_HashRaw.h> //Only use raw sender
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 3; // the number of the IR LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
IRsendRaw mySender;
void setup() {
// initialize the IR LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the button pin as an input:
pinMode(buttonPin, INPUT);
}
#define RAW_DATA_LEN 68 //SAMSUNG Controller ON
uint16_t rawData[RAW_DATA_LEN]={
4438, 4662, 418, 1830, 422, 1822, 434, 1818,
450, 654, 470, 654, 454, 626, 482, 674,
454, 654, 462, 1770, 482, 1794, 478, 1762,
478, 630, 498, 630, 478, 622, 494, 630,
478, 626, 498, 630, 474, 1782, 486, 618,
494, 610, 514, 622, 478, 626, 490, 638,
486, 614, 486, 1774, 498, 606, 510, 1742,
506, 1786, 466, 1758, 510, 1758, 494, 1766,
486, 1774, 494, 1000};
void loop() {
// read the state of the button value:
buttonState = digitalRead(buttonPin);
// check if the button is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
mySender.send(rawData,RAW_DATA_LEN,36);
}
}