Based on this project, I have the following code which I can compile in the Arduino IDE and it runs successfully on my breadboarded UNO. However I would like continue development in B4R rather than the Arduino IDE because I want to send characters via Bluetooth rather than hardware serial.
I can handle re-writing the body of the code, however I am unsure what I need to do with the #include <skIRremote.h> part. I expect it needs to be converted to a library which would handle the call to irsend. The ssIRremote library was written by the author of the above project and he said that is just the Arduino IRremote library to which he added support for the Foxtel IQ remote. His library files are here.
Would I be better working with the rIRremote library referenced here and modifying it based on the information above so it too will support for the Foxtel IQ remote?
Thanks in anticipation of any guidance as I'm now well out of my depth,
Bryon
I can handle re-writing the body of the code, however I am unsure what I need to do with the #include <skIRremote.h> part. I expect it needs to be converted to a library which would handle the call to irsend. The ssIRremote library was written by the author of the above project and he said that is just the Arduino IRremote library to which he added support for the Foxtel IQ remote. His library files are here.
Would I be better working with the rIRremote library referenced here and modifying it based on the information above so it too will support for the Foxtel IQ remote?
Thanks in anticipation of any guidance as I'm now well out of my depth,
Bryon
B4X:
/*
* Sending all Foxtel remote keys as IR codes with IRsend
* An IR LED in series with a resistor (180r) must be connected to Arduino PWM pin 3 and GND long led lead to +ve.
* Version 1.0 November 2018
* Bryon Dunkley-Smith
*
*/
#include <skIRremote.h>
IRsend irsend;
char receivedChar;
boolean newData = false;
void setup() {
Serial.begin(9600);
}
void loop() {
recvOneChar();
showNewData();
}
void recvOneChar() {
if (Serial.available() > 0) {
receivedChar = Serial.read();
newData = true;
}
}
void showNewData() {
if (newData == true) {
switch(receivedChar){
case '0':
sendIR(0x00, receivedChar); // IQ 0 command
break;
case '1':
sendIR(0x01, receivedChar); // IQ 1 command
break;
case '2':
sendIR(0x02, receivedChar); // IQ 2 command
break;
case '3':
sendIR(0x03, receivedChar); // IQ 3 command
break;
case '4':
sendIR(0x04, receivedChar); // IQ 4 command
break;
case '5':
sendIR(0x05, receivedChar); // IQ 5 command
break;
case '6':
sendIR(0x06, receivedChar); // IQ 6 command
break;
case '7':
sendIR(0x07, receivedChar); // IQ 7 command
break;
case '8':
sendIR(0x08, receivedChar); // IQ 8 command
break;
case '9':
sendIR(0x09, receivedChar); // IQ 9 command
break;
case 'A':
sendIR(0x0C, receivedChar); // IQ Power command
break;
case 'B':
sendIR(0x0D, receivedChar); // IQ Mute command
break;
case 'C':
sendIR(0x0F, receivedChar); // IQ Mute command
break;
case 'D':
sendIR(0x10, receivedChar); // IQ Vol+ command
break;
case 'E':
sendIR(0x11, receivedChar); // IQ Vol- command
break;
case 'F':
sendIR(0x20, receivedChar); // IQ Chn+ command
break;
case 'G':
sendIR(0x21, receivedChar); // IQ Chn- command
break;
case 'H':
sendIR(0x28, receivedChar); // IQ Fwd command
break;
case 'I':
sendIR(0x29, receivedChar); // IQ Rew command
break;
case 'J':
sendIR(0x2C, receivedChar); // IQ Play command
break;
case 'K':
sendIR(0x30, receivedChar); // IQ Pause command
break;
case 'L':
sendIR(0x31, receivedChar); // IQ Stop command
break;
case 'M':
sendIR(0x37, receivedChar); // IQ Record command
break;
case 'N':
sendIR(0x38, receivedChar); // IQ AV command
break;
case 'O':
sendIR(0x4E, receivedChar); // IQ Foxtel command
break;
case 'P':
sendIR(0x54, receivedChar); // IQ Setup command
break;
case 'Q':
sendIR(0x58, receivedChar); // IQ Up command
break;
case 'R':
sendIR(0x59, receivedChar); // IQ Down command
break;
case 'S':
sendIR(0x5A, receivedChar); // IQ Left command
break;
case 'T':
sendIR(0x5B, receivedChar); // IQ Right command
break;
case 'U':
sendIR(0x5C, receivedChar); // IQ Select command
break;
case 'V':
sendIR(0x6D, receivedChar); // IQ Red command
break;
case 'W':
sendIR(0x6E, receivedChar); // IQ Green command
break;
case 'X':
sendIR(0x6F, receivedChar); // IQ Yellow command
break;
case 'Y':
sendIR(0x70, receivedChar); // IQ Blue command
break;
case 'Z':
sendIR(0x81, receivedChar); // IQ Help command
break;
case 'a':
sendIR(0x83, receivedChar); // IQ Back command
break;
case 'b':
sendIR(0xCC, receivedChar); // IQ TV Guide command
break;
case 'c':
sendIR(0xD5, receivedChar); // IQ Box Office command
break;
case 'd':
sendIR(0xF4, receivedChar); // IQ Planner command
break;
case 'e':
sendIR(0xFD, receivedChar); // IQ Active command
break;
}
}
}
void sendIR(byte code, char rxdChar) {
irsend.sendFox(code); // IQ command
newData = false;
delay(500);
}