Jump to content
ELFORUM - Forumul electronistilor
stone100

Delay intre doua operatii

Recommended Posts

Salut :)

 

Cum pot eu sa modific delayul din momentul in care se aprind ledurile de semnalizare si ceata , dar fara sa afecteze intervalul de raspuns al celei de faza scurta , nu pot sa ii dau de capat

 

Video : https://www.youtube.com/watch?v=KBd_W_ZyG0A

int led = 2; //semnalizare stanga
int led2 = 4; //semnalizare dreapta
int led3 = 7; //ceata
int ledPin = 3;    // faza scurta

void setup() { 
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
 
}

void loop() {
   digitalWrite(led, HIGH);   // incepe jocu pe 1  semnalizare
  delay(100);               
  digitalWrite(led, LOW);    
  delay(100); 
  {digitalWrite(led2, HIGH);
    delay(100);
  digitalWrite(led2, LOW);
    delay(100);}              // terminare joc 1 semnalizare
    digitalWrite(led, HIGH);   // incepere joc 1' semnalizare
  delay(100);               
  digitalWrite(led, LOW);    
  delay(100); 
  {digitalWrite(led2, HIGH);
    delay(100);
  digitalWrite(led2, LOW);
    delay(100);}              //terminare joc 1' semnalizare
  
  
  digitalWrite(led, HIGH);   //  incepere joc 2 cliparire semnalizare
  digitalWrite(led2, HIGH);  
  delay(100);              
  digitalWrite(led, LOW);     
  digitalWrite(led2, LOW);
  delay(100);                 // terminare joc 2cliparire semnalizare
  digitalWrite(led, HIGH);   // incepere joc 2'cliparire semnalizare
  digitalWrite(led2, HIGH);  
  delay(100);              
  digitalWrite(led, LOW);     
  digitalWrite(led2, LOW);  //terminare joc 2'
  delay(100);  
 
  {delay(1); // intarziere joc                  
  digitalWrite(led, HIGH);   // led stanga 
  digitalWrite(led2, HIGH); //led dreapta
  digitalWrite(led3, HIGH);   // led ceata
  delay(1500);  }                    
  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 1) { // apindere led faza scurta treptat
  analogWrite(ledPin, fadeValue);
   delay(20);}
     

        
  
   
   {digitalWrite(led, LOW);    // se stinge semnalizarea
  digitalWrite(led2, LOW);
  delay(1); 
  digitalWrite(led3, LOW);    // stinge led ceata
  delay(50); }
  delay(1000);
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5){ //stingere decrementata faza scurta
    analogWrite(ledPin, fadeValue);
   delay(60);}

    
    // delay(20);}
     
//delay(2500); // cat sta aprins
 
  
   
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines