Hi guys. Very experienced in VisStudio C++ for PC but rusty and just starting with Arduino. I'm finding the structure is a little different.
I have a long winded project for an Arduino Mega which I have working in a very one dimensional .ino file only form. In essence it's nothing functionally very complicated, just a number of switches and LEDs compiling circuitous selection logic into a coded packet and pushing it out over a serial line. That all works fine but is long and unwieldy being in a single file.
So I'm now rewriting it and splitting it out into a number of classes and additional files. The new classes don't give too much trouble as they are stand alone encapsulated functionality. One thing I read about and have tried to set up is the idea of the .ino only containing the core Arduino functions and all other basic non class member functions being moved into a pair of "HelperFunction" files. This seemed a tidy approach so I went with it.
So now I have a HelperFunction.h for declarations and a HelperFunction.cpp for definitions. These functions are called from within the setup() and loop() functions in the .ino, so HelperFunction.h is #include-d into the .ino file. It seems to me at first sight that the Arduino approach is to basically declare a lot of globals at the start of the .ino file. As you need to access these from within the HelperFunction .h and .cpp files I would have hope dthey were global in scope and be seen but this is not what I'm finding. It compiles a lot of "was not declared in this scope" errors. Moving them to the HelperFunction header file causes other problems and to be honest just plain feels wrong. I don't know what the Arduino approach to this issue is.
I obviously don't really have a clear picture of the relationship between the .ino file and other non-class oriented files like my HelperFunction pair. Can someone point out where I'm going wrong in making this work? Or have I got the concept of those HelperFunctions wrong in some way?