let me start over and let me present my libraries.
Here is the Sensor Library
#ifndef Sensor
#define Sensor
#include "WProgram.h"
class Sensor
{
public:
Sensor();
~Sensor();
boolean viewIsClear();
private:
int sensorPin;
int sensorVal;
};
#endif
#include "WProgram.h"
#include "sensor.h"
Sensor::Sensor()
{
sensorPin = 4;
sensorVal = 0;
}
boolean Sensor::viewIsClear()
{
sensorVal = analogRead(sensorPin);
if (sensorVal > 370)
{
carOK = false;
return false;
}
else
return true;
}
Sensor::~Sensor()
{
}
Here is the Wheel Library
#ifndef Wheel
#define Wheel
#include "WProgram.h"
class Wheel
{
public:
Wheel();
~Wheel();
void controlRightFront(boolean one, boolean two, int x);
void controlRightRear(boolean one, boolean two, int x);
void controlLeftFront(boolean one, boolean two, int x);
void controlLeftRear(boolean one, boolean two, int x);
void forward(int x);
void slowDown(boolean one, boolean two, int x);
void halt();
boolean forwardDrive;
boolean reverseDrive;
private:
int rightfrontmotorOne;
int rightfrontmotorTwo;
int rightrearmotorOne;
int rightrearmotorTwo;
int leftfrontmotorOne;
int leftfrontmotorTwo;
int leftrearmotorOne;
int leftrearmotorTwo;
int enablePinRF;
int enablePinRR;
int enablePinLF;
int enablePinLR;
};
#endif
#include "WProgram.h"
#include "Wheel.h"
Wheel::Wheel()
{
rightfrontmotorOne = 0;
rightfrontmotorTwo = 1;
rightrearmotorOne = 8;
rightrearmotorTwo = 12;
leftfrontmotorOne = 2;
leftfrontmotorTwo = 3;
leftrearmotorOne = 4;
leftrearmotorTwo = 7;
enablePinRF = 2;
enablePinRR = 4;
enablePinLF = 5;
enablePinLR = 3;
pinMode(rightfrontmotorOne, OUTPUT);
pinMode(rightfrontmotorTwo, OUTPUT);
pinMode(rightrearmotorOne, OUTPUT);
pinMode(rightrearmotorTwo, OUTPUT);
pinMode(leftfrontmotorOne, OUTPUT);
pinMode(leftfrontmotorTwo, OUTPUT);
pinMode(leftrearmotorOne, OUTPUT);
pinMode(leftrearmotorTwo, OUTPUT);
pinMode(enablePinRF, OUTPUT);
pinMode(enablePinRR, OUTPUT);
pinMode(enablePinLF, OUTPUT);
pinMode(enablePinLR, OUTPUT);
}
Wheel::~Wheel()
{
}
void Wheel::controlRightFront(boolean one, boolean two, int x)
{
analogWrite(enablePinRF, x);
digitalWrite(rightfrontmotorOne, one);
digitalWrite(rightfrontmotorTwo, two);
}
void Wheel::controlRightRear(boolean one, boolean two, int x)
{
analogWrite(enablePinRR, x);
digitalWrite(rightrearmotorOne, one);
digitalWrite(rightrearmotorTwo, two);
}
void Wheel::controlLeftFront(boolean one, boolean two, int x)
{
analogWrite(enablePinLF, x);
digitalWrite(leftfrontmotorOne, one);
digitalWrite(leftfrontmotorTwo, two);
}
void Wheel::controlLeftRear(boolean one, boolean two, int x)
{
analogWrite(enablePinLR, x);
digitalWrite(leftrearmotorOne, one);
digitalWrite(leftrearmotorTwo, two);
}
void Wheel::reverse(int x)
{
if (forwardDrive == true)
{
halt();
delay(500);
}
reverseDrive = true;
controlRightFront(LOW,HIGH,x);
controlRightRear(LOW,HIGH,x);
controlLeftFront(LOW,HIGH,x);
controlLeftRear(LOW,HIGH,x);
forwardDrive = false;
}
void Wheel::forward(int x)
{
if (reverseDrive == true)
{
halt();
delay(500);
}
forwardDrive = true;
controlRightFront(HIGH,LOW,x);
controlRightRear(HIGH,LOW,x);
controlLeftFront(HIGH,LOW,x);
controlLeftRear(HIGH,LOW,x);
reverseDrive = false;
}
void Wheel::halt()
{
controlRightFront(LOW,LOW,0);
controlRightRear(LOW,LOW,0);
controlLeftFront(LOW,LOW,0);
controlLeftRear(LOW,LOW,0);
}
void Wheel::slowDown(boolean one, boolean two, int x)
{
controlRightFront(one,two,x);
controlRightRear(one,two,x);
controlLeftFront(one,two,x);
controlLeftRear(one,two,x);
}
Here is the ServoView Class
#ifndef ServoView
#define ServoView
#include "WProgram.h"
#include <Servo.h>
class ServoView
{
public:
ServoView();
~ServoView();
void StartRotateServo(int x);
void StopRotateServo();
private:
Servo mainServo;
int servoPin;
int servoVal;
};
#endif
#include "WProgram.h"
#include "servoView.h"
#include <Servo.h>
ServoView::ServoView()
{
servoPin = 13;
servoVal = 0;
mainServo.attach(servoPin);
}
void ServoView::StartRotateServo(int x)
{
mainServo.write(x);
}
void ServoView::StopRotateServo()
{
mainServo.write();
}
ServoView::~ServoView()
{
mainServo.detach(servoPin);
}
And Here are the Errors I am getting
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Direction/servoView.h:10:19: error: Servo.h: No such file or directory
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Sensor/sensor.h:14: error: expected unqualified-id before ')' token
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Sensor/sensor.h:15: error: expected class-name before '(' token
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Sensor/sensor.h:12: error: an anonymous struct cannot have function members
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Sensor/sensor.h:21: error: abstract declarator '' used as declaration
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Wheel/wheel.h:14: error: expected unqualified-id before ')' token
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Wheel/wheel.h:15: error: expected class-name before '(' token
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Wheel/wheel.h:12: error: an anonymous struct cannot have function members
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Wheel/wheel.h:40: error: abstract declarator '' used as declaration
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Direction/servoView.h:15: error: expected unqualified-id before ')' token
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Direction/servoView.h:16: error: expected class-name before '(' token
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Direction/servoView.h:20: error: 'Servo' does not name a type
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Direction/servoView.h:13: error: an anonymous struct cannot have function members
/Applications/Arduino.app/Contents/Resources/Java/hardware/libraries/Direction/servoView.h:24: error: abstract declarator '' used as declaration
error: expected constructor, destructor, or type conversion before ';' token In function 'void loop()':