At school I am building a robot that should be able to detect lines using 3 power sensors QRE1113. (http://www.sparkfun.com/products/9454) I created 4 libraries, two for driving (Motor () and Driver ()), they work fine. Now I have created the Linesensor and Eye libraries, this causes some problems. When I want to use these libraries, the setup () function will not execute the command. Do not even turn on the LED. What is the problem?
Main file:
#include "Motor.h"
#include "Driver.h"
#include "Lichtsensor.h"
#include "Eye.h"
Motor motor1(5, 4, true);
Motor motor2(6, 7, false);
Driver driver(motor1, motor2);
Eye eye1;
void setup(){
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
Serial.begin(9600);
Serial.println("#################################################");
Serial.println("# This sketch communicates with the arduino and #");
Serial.println("# makes the robot drive, and react to a sensor. #");
Serial.println("#################################################\n");
}
void loop(){
if (eye1.getDikkeLijn() == true) {
Serial.println("Lijn");
}
else {
Serial.println("Niks");
}
delay(1000);
}
Eye Library:
#ifndef Eye_h
#define Eye_h
#include "Arduino.h"
#include "Lichtsensor.h"
class Eye
public:
Eye();
Eye(Lichtsensor l1, Lichtsensor l2, Lichtsensor l3);
boolean getDikkeLijn();
boolean getDunneLijn();
private:
Lichtsensor _l1;
Lichtsensor _l2;
Lichtsensor _l3;
};
#endif
And the line:
#ifndef Lichtsensor_h
#define Lichtsensor_h
#include "Arduino.h"
class Lichtsensor {
public:
Lichtsensor();
Lichtsensor(int analogPin);
int getCalibreerWaarde();
int getLichtWaarde();
boolean isDonker();
private:
int _lichtCalibreerWaarde;
int _analogPin;
};
#endif
source
share