I am having some trouble with writing classes in Arduino. Here is a class called "Jerry." It contains three instances of user-defined classes called Mouth, Move, and Injection. The Arduino IDE complains 'Mouth' does not name a type, and 'Move' does not name a type. How can I make Arduino recognize Mouth and Move as valid types?
#ifndef JERRY_H
#define JERRY_H
include "Button.h"
include "Injection.h"
class Jerry
{
protected:
int BGL;
double protein_conc;
public:
Jerry(int, int);
Mouth mth;
Move mv;
Injection inj;
volatile long prev_interrupt_time;
};
#endif // JERRY_H
(# signs removed because it screws up the formatting in StackOverflow)
The Mouth, Move, and Injection class declarations are below:
#ifndef BUTTON_H
#define BUTTON_H
include "Jerry.h"
class Button
{
public:
void setPin(int);
int getPin();
bool check(Jerry);
virtual void run();
protected:
int pin;
};
class Mouth : public Button
{
public:
int detectFood();
void run();
};
class Move : public Button
{
public:
bool checkLaughing();
void runLaughing();
bool checkSleep();
};
#endif // BUTTON_H
#ifndef INJECTION_H
#define INJECTION_H
class Injection
{
public:
void setPin(int, int, int, int);
void checkInjection();
void checkInjectionSite();
protected:
int pin1;
int pin2;
int pin3;
int pin4;
};
#endif // INJECTION_H
any help would be greatly appreciated.