kippertoffee
New member
Hi,
I'm making a project with USB host midi and I was hoping to encapsulate the host midi functionality within another class, but I have immediately come across a stumbling block...
If I take the InputFunctions.ino for example and I replace these lines
With a class definition:
I get these errors:
I have also tried something along the lines of:
and while this compiles, the sketch no longer works.
I'm pretty new to all this stuff and really dont understand what's going on. Any help would be super.
I'm making a project with USB host midi and I was hoping to encapsulate the host midi functionality within another class, but I have immediately come across a stumbling block...
If I take the InputFunctions.ino for example and I replace these lines
Code:
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
MIDIDevice midi1(myusb);
With a class definition:
Code:
class TestClass
{
public:
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
MIDIDevice midi1(myusb);
}
I get these errors:
InputFunctions:32: error: 'myusb' is not a type
USBHub hub1(myusb);
^
InputFunctions:33: error: 'myusb' is not a type
USBHub hub2(myusb);
^
InputFunctions:34: error: 'myusb' is not a type
MIDIDevice midi1(myusb);
I have also tried something along the lines of:
Code:
class test
{
public:
USBHost* myusb;
MIDIDevice* midi1;
TestClass()
{
myusb = new USBHost;
midi1 = new MIDIDevice(myusb);
}
}
and while this compiles, the sketch no longer works.
I'm pretty new to all this stuff and really dont understand what's going on. Any help would be super.