boolean test1=false;
boolean test2=true;
void setup() {
Serial.begin(9600);
for(int i;i<6;i++){
DDRD |=1<<i;
}
PORTD |=1<<2;
PORTD |=1<<4;
DDRD &=~(1<<7);
DDRD &=~(1<<6);
PORTD |=1<<7;
PORTD |=1<<6;
}
void loop() {
if((PIND&(1<<6)) !=0 && test1 != true){
krok();
}
if((PIND&(1<<6)) ==0){
test2=false;
test1=true;
krokVzad();
}
if((PIND&(1<<7)) !=0 && test2 != true){
krok2();
}
if((PIND&(1<<7)) ==0){
test2=true;
krok2Vzad();
Serial.println("Koniec kalibracie");
}
}
void krok(){
PORTD |=1<<3;
delay(100);
PORTD &=~(1<<3);
delay(100);
}
void krokVzad(){
for(int i=0;i<20;i++){
PORTD &=~(1<<2);
PORTD |=1<<3;
delay(100);
PORTD &=~(1<<3);
delay(100);
}
}
void krok2Vzad(){
for(int i=0;i<20;i++){
PORTD &=~(1<<4);
PORTD |=1<<5;
delay(100);
PORTD &=~(1<<5);
delay(100);
Serial.println("krokvzad2");
}
}
void krok2(){
PORTD |=1<<5;
delay(100);
PORTD &=~(1<<5);
delay(100);
}