I could be wrong, but I believe that the main error is you are trying to calling a non static method...
That is: MIDI.setHandleClock(MidiCallback);
The method MidiCallback is not static, so the system wants to call this method with a "this" pointer to the instance of your Midi Controller class. The problem is that the setHandleClock wants a simple function void Myfunction(void)... So it errors.
You can solve this assuming that you are not expecting to have multiple of these objects by doing something like:
Code:
#ifndef MidiController_h
#define MidiController_h
#include "Arduino.h"
class MidiController
{
public:
MidiController();
static void MidiCallback();
void next();
};
#endif
This would be fine as long as you are not expecting to have multiple of these objects and you are not interested in a pointer to the actual object being passed to the method... Otherwise you may need/want to setup some other way to get the this pointer...
There are multiple ways to do that, including I believe some magic c++ wrapping stuff.
But I have seen/used things like: Have an array of this pointers as a static array as part of the class, then have a number of static callback functions, which then callback to the main class code, and some form of register function, that you say register this object with the array. The register, looks for an empty spot, saves the this pointer, with that spot, likewise registers the appropriate static callback for that index, with the Midi code. If that callback is called, you then do something like: my_this_pointers[object_instance_index]->doCallbackCode()...
Hope that makes a little sense
Kurt