#define LED1 13
#define LED2 12
#define BUMPER_L 7
#define BUMPER_R 8
#define SENZOR_L 0
#define SENZOR_R 1
void setup()
{
Serial.begin(9600);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(BUMPER_L, INPUT);
pinMode(BUMPER_R, INPUT);
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
Serial.print("Starting\n");
}
void blikej() //Blika LED na pinu 12 a 13
{
}
void diag() //Pousti DIAGNOSTIKU
{
Serial.print("DIAGNOSTIKA \n");
while (1)
{
Serial.print(analogRead(SENZOR_L));
Serial.print("\t");
Serial.print(analogRead(SENZOR_R));
Serial.print("\n");
}
}
void stopuj() //Pousti HLEDANI
{
Serial.print("HLEDANI CARY \n");
while (1)
{
}
}
void loop() //HLAVNI SMYCKA
{
blikej();
if(digitalRead(BUMPER_L) == 1) //diagnostika
{
digitalWrite(LED1, LOW);
diag();
}
if(digitalRead(BUMPER_R) == 1) //stopar
{
digitalWrite(LED2, LOW);
stopuj();
}
}