Demo entry 6342821

tralala

   

Submitted by Ola on Jan 07, 2017 at 16:40
Language: Arduino. Code size: 1.9 kB.

void setup() {                
  pinMode(2, OUTPUT); //RED
  pinMode(4, OUTPUT);  //YELLOW
  pinMode(7, OUTPUT);  //GREEN
  pinMode(9, OUTPUT); //RED RGB
  pinMode(10, OUTPUT); //GREEN RGB
  pinMode(11, OUTPUT); //BLUE RGB
  pinMode(13, INPUT); // BUTTON
}
void loop() 
{  
  sygnaly();
}

void sygnaly(){     //FUNKCJA POMOCNICZA, KTORA WYWOLUJE SAMA SIEBIE
  digitalWrite(2, HIGH); // RED
  analogWrite(9,255); //RED RGB
  delay(2000);
  analogWrite(10,255); //YELLOW RGB
  delay(2000);
  digitalWrite(4, HIGH); //YELLOW
  analogWrite(9,0); //GREEN RGB
  delay(2000);
  digitalWrite(2, LOW); //OFF
  digitalWrite(4, LOW); //OFF
  digitalWrite(7, HIGH); //GREEN
  analogWrite(11,255); //CYAN RGB
  for(int i=0; i<2000; i=i+1) {  //TWORZE PETLE, KTORA CO 0.1 SEKUNDY SPRAWDZA, CZY WCISNELISMY PRZYCISK
    if(digitalRead(13)==HIGH) {  //PETLA URUCHAMIA SIE TYLKO WTEDY, GDY WLACZONE JEST SWIATLO ZIELONE
      digitalWrite(7,HIGH);
      analogWrite(9,255);
      analogWrite(10,255);
      analogWrite(11,255);
      delay(5000);
      digitalWrite(7,LOW);
      analogWrite(9,0);
      analogWrite(10,0);
      analogWrite(11,0);
      sygnaly();}   //PO WYKONANIU WARUNKU ROZPOCZYNAMY PROGRAM OD NOWA
    else {
        delay(1);
      }
  }
  analogWrite(10,0); //BLUE RGB
    for(int i=0; i<2000; i=i+1) { //PONOWNIE PETLA
     if(digitalRead(13)==HIGH) {
      digitalWrite(7,HIGH);
      analogWrite(9,255);
      analogWrite(10,255);
      analogWrite(11,255);
      delay(5000);
      digitalWrite(7,LOW);
      analogWrite(9,0);
      analogWrite(10,0);
      analogWrite(11,0);
      sygnaly();}
     else {
        delay(1);
      }
  }
  digitalWrite(7, LOW); //OFF
  digitalWrite(4, HIGH); //YELLOW
  analogWrite(9,255); //MAGENTA RGB
  delay(2000);
  analogWrite(11,0); //RED RGB AGAIN
  digitalWrite(4, LOW); //OFF
}



  

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).