Commit 005627fb authored by Sacha Guilbert's avatar Sacha Guilbert

Simplefied code and addeddebug code

parent 536a4a2a
int LightsensorA1=A1;
int LightsensorA0=A0;
//int sensorValue; //Right sensor
//int sensorValue2; // Left sensor
#include "olimexcontroller.h"
void setup(){
Serial.begin(9600);
}
int sensorValue() {
return 1023-analogRead(LightsensorA1); // read analog input pin 0
}
int sensorValue2() {
return 1023-analogRead(LightsensorA0);
}
void loop()
{
OlimexController motorController(4, 5, 6, 7);
motorController.setup();
motorController.execute('w');
delay(50);
motorController.execute('x');
delay(500);
Serial.println("sensorValue2");
Serial.println(sensorValue2());
Serial.println("sensorValue");
Serial.println(sensorValue());
while(sensorValue2() < 15) {
motorController.execute('a');
delay(100);
motorController.execute('x');
}
while(sensorValue() < 15) {
motorController.execute('d');
delay(100);
motorController.execute('x');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment