Đối với trường học, tôi đang xây dựng một rô-bốt cần có khả năng phát hiện các đường bằng 3 đường dây QRE1113. (http://www.sparkfun.com/products/9454) Tôi đã tạo 4 thư viện, hai thư viện để điều khiển (Motor() & Trình điều khiển()) chúng hoạt động tốt. Bây giờ tôi đã tạo ra các thư viện Linesensor và Eye, chúng đang gây ra một số rắc rối. Khi tôi muốn sử dụng các thư viện này, hàm setup() sẽ không làm đội hình. Thậm chí không bật đèn LED. Hình như có vấn đề gì thì phải?Arduino: Thiết lập() sẽ không bắt đầu
tập tin chi tiết:
#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);
}
thư viện Mắt:
/*
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
Và 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
thể vấn đề này có làm gì đó với số lượng bộ nhớ hạn chế trên bảng Arduino? –