I am trying to create a few classes to use in my project. The problem is I get an error whenever I try to include multiple header files saying that the second class I import is not a valid type. Each of my classes work fine if I import only one.
Any help would be greatly appreciated.
main.ino
#include "ranger.h"
#include "speedControl.h"
ranger myRanger(7,8);
speedControl mySC(1);
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print(" Range: ");
Serial.print(myRanger.medianPingCM(5));
Serial.print(" cm ");
Serial.print(myRanger.pingCM());
Serial.println(" cm");
delay(10);
}
ranger.h
#ifndef ranger_h
#define ranger_h
#include "Arduino.h"
class ranger{
public:
ranger(int pingPin, int inputPin); // the constructor for the class. attaches the ranger object to a pin number
long ping();
long pingCM();
long pingIN();
void setPin(int pingPin, int inputPin);
long medianPing(int totalPings);
long medianPingCM(int totalPings);
long medianPingIN(int totalPings);
private:
int _pingPin, _inputPin;
long microsecondsToCentimeters(long microseconds);
long microsecondsToInches(long microseconds);
};
...
speedControl.h
#ifndef speedControl_h
#define speedControl_h
#include <Servo.h>
#include "Arduino.h"
// end boiler plate
class speedControl{
public:
...