Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
Never
// C++ code
//
void setup()
{
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  Seril.begin(9600);
}

void loop()
{
 int rasgele=random(5);
  
  if(rastgele==0);{
    ileri();
    delay(2000);
  }
    if(rastgele==1);{
    geri();
    delay(2000);
    }
      
    if(rastgele==2);{
    sag();
    delay(2000);
    }   
    
    if(rastgele==3);{
    sol();
    delay(2000); 
    }
    if(rastgele==4);{
    dur();
    delay(2000);
  }
 
}
void ileri (){
  digitalWrite(12, HIGH);//ileri
  digitalWrite(5, HIGH);//ileri
}
  void geri (){ 
  
  digitalWrite(13, HIGH);//geri
  digitalWrite(4, HIGH);//geri
  } 
  void sag (){
  digitalWrite(12, HIGH);//ileri
  digitalWrite(4, LOW);//ileri
  digitalWrite(5, LOW);//geri
  } 
   void sol(){
  digitalWrite(5, HIGH);//ileri
  digitalWrite(12, LOW);//ileri
  digitalWrite(13, LOW);//geri
   }        
   void dur(){
  digitalWrite(4, LOW);//ileri
  digitalWrite(5, LOW);//ileri
  digitalWrite(12, LOW);//ileri
  digitalWrite(13, LOW);//geri
        
        
   }