I have a very large sketch that uses I2C (via Wire) to display on data on an OLED. The project also has 2 UARTS (one using Serial, the other SoftwareSerial). Anyway, I wanted to break the sketch apart into separate files.
I can move the font / images to a header file and include those in the base ino file, however, if I try to move any function that communicates to the display to a separate file, I get the following:
"lcd.c:6:5: error: 'Wire' undeclared (first use in this function)". Same thing with Serial, however, I was able to pass the serial object with " void function (Stream &Serial). I've searched and searched to no avail. I see that the new Wire is derived from Stream, but declaring my function " void resetRamPointer(Stream &Wire); gives an error of " unexpected & before )
Again, everything works great in one large file, but there has to be a better way of passing resources to separate files. I understand things shouldn't be global, but you can't even do simple pin manipulation is a separate file; it works in any subroutine in the main ino file, but add a .c or .cpp file and it has zero visibility to anything.