//    *****************************************
//    **             RC-SOCCERBOT            **
//    **    Uebungen / Lehrerbegleitbuch     **
//    **                                     **
//    **      Autor: Hannes Runknagel        **
//    **  Copyright: 2007 by GRAUPNER        **
//    **  www.graupner-robotics.de           **
//    *****************************************

#include "qfixSoccerBoard.h"

SoccerBoard robot;


void waitForStart()
{
  robot.ledOn(0);
  robot.waitForButton(0);
  robot.ledOff(0);
}


int main()
{
  int a0, a7;					//Variablen für Analog-Eingänge deklarieren
						
  waitForStart();				//auf Startknopf warten
			
  while(true) {				//Endlosschleife
    a0 = robot.analog(0);		//Analog Werte auslesen
    a0 = robot.analog(0);		//2 x wegen Atmel A/D-Wandler
    a7 = robot.analog(7);		
    a7 = robot.analog(7);

    if (a0 > a7) {				//Links heller als rechts?
      robot.motor(0, -55);		//Linkskurve
      robot.motor(1, 115);  
      robot.motor(2, 40);
    }

    else {
      robot.motor(0, -115);	//Rechtskurve
      robot.motor(1, 55);
      robot.motor(2, -40);	
    }   
  }
}





