daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Dec 17th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int ROT1 = 13;     // Straße 1
  2. int GELB1 = 12;
  3. int GRUEN1 = 11;
  4.  
  5. int ROT2 = 10;      //Straße 2
  6. int GELB2 = 9;
  7. int GRUEN2 = 8;
  8.  
  9.  
  10.  
  11.  
  12. int ledPin = 3; //Blaues light langsam heller machen.
  13.  
  14.  
  15.  
  16. void setup()
  17. {
  18.  
  19.  
  20.  for (int helligkeit =1; helligkeit <= 255; helligkeit = helligkeit +1){
  21.     analogWrite(ledPin, helligkeit);
  22.     delay(20);
  23.   }
  24.   for (int helligkeit =255; helligkeit >= 0; helligkeit = helligkeit -1){
  25.     analogWrite(ledPin, helligkeit);
  26.     delay(20);
  27.   }
  28.  
  29.  
  30.  
  31. pinMode(ROT1, OUTPUT);
  32. pinMode(GELB1, OUTPUT);
  33. pinMode(GRUEN1, OUTPUT);
  34. pinMode(ROT2, OUTPUT);
  35. pinMode(GELB2, OUTPUT);
  36. pinMode(GRUEN2, OUTPUT);
  37. }
  38.  
  39. void loop()
  40. {
  41. //Schalte Straße 1 rot, und Straße 2 grün.
  42. digitalWrite(ROT1, HIGH);
  43. digitalWrite(GRUEN2, HIGH);
  44. delay(10000);
  45.  
  46. //Schalte beide Ampeln auf Gelb
  47. digitalWrite(ROT1, HIGH);
  48. digitalWrite(GELB1, HIGH);
  49. digitalWrite(GELB2, HIGH);
  50. digitalWrite(GRUEN2, LOW);
  51. delay(2000);    
  52.  
  53. //Schalte Straße 1 Grün und Straße 2 Gelb.
  54. digitalWrite(ROT1, LOW);
  55. digitalWrite(GELB1, LOW);
  56. digitalWrite(GELB2, LOW);
  57. digitalWrite(ROT2, HIGH);
  58. digitalWrite(GRUEN1, HIGH);
  59. delay(10000);
  60.  
  61. //Schalte beide Ampeln auf Gelb.
  62. digitalWrite(GRUEN1, LOW);
  63. digitalWrite(GELB1, HIGH);
  64. digitalWrite(GELB2, HIGH );
  65. digitalWrite(ROT2, HIGH);
  66. delay(2000);
  67.  
  68. // Schalte Straße 1 Rot und Straße 2 Rot.
  69. digitalWrite(GELB1, LOW);
  70. digitalWrite(ROT1, HIGH);
  71. digitalWrite(ROT2, LOW);
  72. digitalWrite(GELB2, LOW);
  73. digitalWrite(GRUEN2, HIGH);
  74. delay(10000);
  75.  
  76.  
  77.  
  78.  
  79. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top