/*
 * KU Corobot Example: Track-Line
 * 
 * Follow a black line using left and right reflectivity sensors
 */
#include <Wire.h>
#include <Adafruit_TCS34725.h>
#include <Corobot.h>

#define CRUISE_SPEED 50

void setup() {
  Corobot.init();
}

void loop() {
  int lt = Corobot.getLeftEye();
  int rt = Corobot.getRightEye();
  
  if (lt && rt) {
    Corobot.setLeftMotor(FORWARD,CRUISE_SPEED);
    Corobot.setRightMotor(FORWARD,CRUISE_SPEED);
  }
  if (!lt && rt) {
    Corobot.setLeftMotor(FORWARD,0);
    Corobot.setRightMotor(FORWARD,CRUISE_SPEED);
  }
  if (lt && !rt) {
    Corobot.setLeftMotor(FORWARD,CRUISE_SPEED);
    Corobot.setRightMotor(FORWARD,0);
  }
  if (!lt && !rt) {
    Corobot.setLeftMotor(FORWARD,0);
    Corobot.setRightMotor(FORWARD,0);
  }
}

