Hey!
I have some problems to adapt the existing library to work via a Port Expander.
Library to adapt: IRremote
Library to communicate: Adafruit
Port Expander: MCP23017
Arduino: Uno
My idea was to “just” edit the input pin, that it uses one MCP pin and sends the signal to the Arduino.
I attached both the edited .cpp and .h file.
To make it easier, I will post here what I edited:
I’ll start with the .cpp file. I added this at the top to get the libraries in and started:
#include "../Adafruit-MCP23017-Arduino-Library-master/Adafruit_MCP23017.h"
#include "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\Wire.h"
Adafruit_MCP23017 mcp;
mcp.begin();
Then I changed this at line 366/367 to activate the right pin at the MCP:
// set pin modes
mcp.pinMode(irparams.recvpin, INPUT);
After this I went to line 389 to read from the right pin:
uint8_t irdata = (uint8_t)mcp.digitalRead(irparams.recvpin);
That was all for the .cpp file. Now comes the .h file. I just added some lines in the beginning:
#include "../Adafruit-MCP23017-Arduino-Library-master/Adafruit_MCP23017.h"
#include "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\Wire.h"
So my problem with this probably wrong solution is that it never stops to compiling. I’m actually expecting an error with the strange import of the wire library, but I didnot found anything else to stop giving this error message to me:
C:\Users\MYUSERNAME\Documents\Arduino\libraries\Simpletest\Simpletest.cpp:1:18: fatal error: Wire.h: No such file or directory
#include <Wire.h>
^
compilation terminated.
Error compiling.
So, does anyone of you know what I am doing wrong? Any help appreciated. Thanks.
Greetings,
Alex.
IRremote.cpp (36.5 KB)
IRremote.h (5.42 KB)