daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Pin 13 wordt gebruikt om te tellen van 1-7 - active LOW
  3. Pin 10, 11 en 12 worden gebruikt om de binaire waarden te weergeven.
  4. Pin 9 wordt gebruikt voor de gele LED.
  5. Pin 8 wordt gebruikt om de gele LED te resetten - active HIGH
  6. */
  7.  
  8.  
  9. void setup() {
  10.   pinMode(12,OUTPUT);
  11.   pinMode(11,OUTPUT);
  12.   pinMode(10,OUTPUT);
  13.   pinMode(9,OUTPUT);
  14.   pinMode(13,INPUT);
  15.   pinMode(8,INPUT);
  16.   Serial.begin(9600);
  17.   delay(1000);
  18. }
  19.  
  20. int teller = 0;
  21. int teller2 = 0;
  22. int x = true;
  23. int valuePot = 0;
  24.  
  25.  
  26. void loop() {
  27.   x = true;
  28.   if (digitalRead(13)==LOW){
  29.     while(digitalRead(13)==LOW);
  30.     delay(30);
  31.     teller++;
  32.     teller2 = 0;
  33.     Serial.println(teller);
  34.   }
  35.  
  36.  
  37.  
  38.   Serial.println(String(teller2) + "|" + String(valuePot));
  39.   teller2++;
  40.   valuePot = analogRead(A0) * 2;
  41.   if (teller2 > valuePot) {
  42.     while(x){
  43.       digitalWrite(9, LOW);
  44.       delay(200);
  45.       digitalWrite(9, HIGH);
  46.       delay(200);
  47.       if (digitalRead(8)==HIGH){
  48.         teller2 = 0;
  49.         x = false;
  50.         }  
  51.       }
  52.     }
  53.    
  54.   switch(teller) {
  55.    case 1:
  56.      digitalWrite(10,HIGH);
  57.      digitalWrite(12,LOW);
  58.      digitalWrite(11,LOW);
  59.      digitalWrite(9,LOW);
  60.      break;
  61.      
  62.     case 2:
  63.      digitalWrite(11,HIGH);
  64.      digitalWrite(10,LOW);
  65.      break;
  66.      
  67.     case 3:
  68.      digitalWrite(10,HIGH);
  69.      digitalWrite(11,HIGH);
  70.      break;
  71.      
  72.     case 4:
  73.      digitalWrite(12,HIGH);
  74.      digitalWrite(11,LOW);
  75.      digitalWrite(10,LOW);
  76.      break;
  77.      
  78.     case 5:
  79.      digitalWrite(10,HIGH);
  80.      digitalWrite(12,HIGH);
  81.      break;
  82.      
  83.     case 6:
  84.      digitalWrite(11,HIGH);
  85.      digitalWrite(10,LOW);
  86.      digitalWrite(12,HIGH);
  87.      break;
  88.      
  89.     case 7:
  90.      digitalWrite(10,HIGH);
  91.      digitalWrite(11,HIGH);
  92.      digitalWrite(12,HIGH);
  93.      digitalWrite(9,HIGH);
  94.      teller = 0;
  95.      break;
  96.    
  97.   }
  98.  
  99. }
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