對於學校我建立一個機器人,需要能夠使用3個QRE1113 linesensors檢測線路。 (http://www.sparkfun.com/products/9454)我創建了4個庫,兩個用於驅動(Motor()& Driver()),它們工作正常。現在我創建了Linesensor和Eye庫,這些都造成了一些麻煩。當我想使用這些庫時,setup()函數將不會執行小隊。甚至不打開LED。什麼似乎是問題?Arduino:安裝程序()不會啓動
主文件:
#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);
}
眼庫:
/*
Controls Lichtsensors
*/
#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
而且linesensor:
/*
Library to get values from a light sensor
*/
#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
難道這個問題有用Arduino板上有限的內存做些什麼? – 2012-03-15 10:55:11